History:
I’m using the children method because I’ll be looping through divs that have content in them that is dynamically generated by the user, so there’s no way of me knowing how many divs there will be. If there is another method I should be using, by all means, show me 🙂
I’m having trouble here using the following code:
$("[name = listItem]").each( function (){
var z = $(this).children("[name='dropDown'] option:selected").val();
alert(z);
});
In this example the output would be an alert box with:
undefined
It’s strange because this way bellow works fine!
var z = $("[name='dropDown'] option:selected").val();
alert(z);
the output for this would be the appropriate value:
1
for the children() method, I thought you could use the standard selector syntax. What do you think?
Try:
Or:
But i am a bit confused as to what
listItem&dropDownare…