i have a div that has a ul elemenet having class="bla" and id="foo"
<div class = new>
<ul class="bla" id="foo"><li>aa</li></ul>
</div>
how can i get id of the ul,, help is appreciable
i have a div that has a ul elemenet having class="bla" and id="foo"
<div class = new>
<ul class="bla" id="foo"><li>aa</li></ul>
</div>
how can i get id of the ul,, help is appreciable
$('.new ul.blah').attr('id')
specifc to uls, and the new container div
$('ul[class=bla]').prop('id')
Will look up the ul element with the specific class bla.
prop('id') will get it's id.
The id is considered a property of the ul, similar to the class and can both be used as selectors, so to use JQuery. you would use the class as the selector for the ul, and then access the ul property id.
$( '.class' ).prop( 'id' );
In this case it would return 'foo'.
EDIT ------
After seeing that you want to use those id's to select them, you could use one of these two methods.
var list = $( '#id' );
or
var list = $( '.class#id' );
The first method will work, but the second method is more explicit. Either one is acceptable though.