I’am a newbie in jquery and I want to parse subchilds in a xml file for a specific child attribute, for example, I have this cities and districts list
<city name="ANKARA">
<distr>BEYPAZARI</distr>
<distr>GÜDÜL</distr>
<distr>KAZAN</distr>
<distr>ÇANKAYA</distr>
</city>
<city name="İSTANBUL">
<distr>EMİNÖNÜ</distr>
<distr>ÇATALCA</distr>
<distr>BEYOĞLU</distr>
<distr>BEYKOZ</distr>
<distr>BEŞİKTAŞ</distr>
</city>
I use this code to get city list
$(xml).find('city').each(function(){
var city = $(this).attr("name");
$("<option>").text(city).appendTo("#cityList");
});
but I don’t how to get the district list of for example Ankara,
someone could help me please
thanks in advance
That’s the “attribute equals” selector you want.