andy
answered Oct 9 '21 00:00
jQuery example to get the element by id .
$("#id").html();
above code wil get html by element id.
jQuery example to get the element by class.
$(".id").html();
above code wil get html by element class.
jQuery example to get all the <a> element from the page.
$("a") ;
above code will return object list of <a> element.
jQuery example to change the html of any element
$("#id").html('i am new') ;
use html() function to get or set value of the html in jQuery.
jQuery example to change the attribute of any element
$("#id").attr('style',"display:none") ;
use attr() function to get or set attrinute of the element in jQuery.