[wd_asp elements=’search’ ratio=’100%’ id=1]

Get the id, value,name,html of element after click function

12th June 2014

Jquery - Variables

jquery icon

$("#mylist li").click(function() {
alert(this.id); //WORK ON JAVASCRIPT ONLY id of clicked li by directly accessing DOMElement property
alert($(this).attr('id')); // jQuery's .attr() method, same but more verbose
alert($(this).html()); // gets innerHTML of clicked li
alert($(this).text()); // gets text contents of clicked li
alert($(this).attr("value"));
});

Maybe this helps also Get element Value Name ID – ATTR

Or maybe getting the length of text input