Home  • Programming • JQuery

jQuery Syntax

The jQuery syntax is tailor made for selecting HTML elements and performing some action on the element(s). Basic syntax is: $(selector).action() A $ sign to define/access jQuery A (selector) to "query (or find)" HTML elements A jQuery action() to be performed on the element(s) Examples: $(this).hide() - hides the current element. $("p").hide() - hides all <p> elements. $(".test").hide() - hides all elements with class="test". $("#test").hide() - hides the element with id="test".

Comments 2


<script>
$(document).ready(function(){
	$("li").click(function(){
	var name=$(this).text();
	 $("img").attr("src",name+".jpg");
	});

});

</script>
thx
About Author
Arif  Mainuddin
Copyright © 2024. Powered by Intellect Software Ltd