stackoverflow newbie 여기에 문제가 발생했을 때 도와 주시면 감사하겠습니다. 나는 이것과 비슷한 몇 가지 질문과 답을 찾았지만 정확히 필요한 것은 없다. 는 XML이 최선의 방법으로 포맷되지 않은 http://www.worldmarket.com/giftfinder/index.jsp체크 상자 형식의 Jquery를 사용하여 XML을 통해 필터링
(: 나는 수 있도록하고 싶습니다 AJAX (JQuery와)를 통해 일부 XML 당기는거야 비슷한이 같은 사이트에 등을 체크 박스를 사용하여 필터링하기 내가)을 통제 할 수없고, 내가 끌어 오기 각 요소에 대해이 비슷한 보이는 :
<element text="something.exe" value="dev|something.exe" depth="0" lastUpdate="2010-03-09 09:50" nextUpdate="" category="Entertainment" filesize="2 MB">
<attribute key="Description" value="here is the description"></attribute>
<attribute key="Language" value="English,Russian,Ukrainian"></attribute>
<attribute key="Function" value="History, Education"></attribute>
<attribute key="Industry" value="Public Sector,Sports"></attribute>
<attribute key="Title" value="Something"></attribute>
<attribute key="Tags" value="Politics"></attribute>
</element>
그래서이 문제는 단순히 통해 반복하지 않고 같은 코드를 사용하여 그리드 내의 모든 요소를 표시 있습니다
$(this).find("element").each(function(index){
var appTitle = $(this).find("attribute[key='Title']").attr("value") || $(this).attr("text");
하지만 내가 겪고있는 문제는 태그를 필터링하는 것입니다. 왼쪽에 여러 태그 (또는 산업 또는 함수 특성)와 연관된 여러 확인란이 있고 싶을 때 클릭하면 그 태그가있는 요소 만 표시되도록 필터가 설정됩니다. 이 작업을 수행하는 가장 좋은 방법은 무엇입니까? 그것은 내가 좋아하는 요소를 말하는 .find()에 뭔가를 추가하려는 것입니다. WHERE tags = ... (나는 SQL 영역으로 떠돌았다는 것을 알고 있지만 ...) 어쨌든, 어떤 도움이나 방향이든지 크게 감사 할 것입니다. 미리 감사드립니다.
도움 주셔서 다시 한 번 감사드립니다.
.has를 사용하여 시도했지만 지금까지 제대로 작동하지 않습니다. 심지어 그냥 위의 더미 데이터로 일반적으로 그것을 테스트, 그것은 작동하지 않습니다
var testThisData = '<element text="something.exe" value="dev|something.exe" depth="0" lastUpdate="2010-03-09 09:50" nextUpdate="" category="Entertainment" filesize="2 MB"><attribute key="Description" value="here is the description"></attribute><attribute key="Language" value="English,Russian,Ukrainian"></attribute><attribute key="Function" value="History, Education"></attribute><attribute key="Industry" value="Public Sector,Sports"></attribute><attribute key="Title" value="Something"></attribute><attribute key="Tags" value="Politics"></attribute></element>';
console.log($(testThisData).has("attribute[key='Language'][value~='English']").length);`
0을 반환도 마찬가지로이 :
console.log($(testThisData).has("attribute").length);
미안 해요, 난 그냥 아니에요 생각 뭔가를 얻는 것. 감사합니다. .
도움이된다면 답을 표시하는 것을 잊지 마십시오. – Andir