I am having <ul class= "list" id = "List">
I want to read the ul id
$("li:last-child input:button").live('click', function () {
var val = $(this).closest('ul').val();
alert(val);
});
How can I do that? In the above the alert is not displaying the id.
val()returns an input’s value. You want the ID attribute:You can use
attr()on a jQuery object oridon a DOM element object to get the ID.