jQuery Multiple selector with simple example in Tamil


jQuery Multiple Selector allows you to select multiple elements using a single jQuery selector. It enables you to combine several selectors into a single selection, targeting elements that match any of the specified criteria. The syntax involves separating the individual selectors with commas.



  • Multiple Elements
  • The jQuery Multiple Selector allows you to select multiple elements based on different criteria.

  • Performance
  • While powerful, selecting too many elements or using complex selectors may impact performance.

  • Use Cases
  • This selector is useful when you want to apply the same operation or style to different types of elements.

  • Combining Selectors
  • You can combine various types of selectors, including element selectors, class selectors, ID selectors, etc., in a single multiple selector.

  • Chaining
  • You can chain additional methods or functions after a multiple selector to perform various operations on the selected elements.

Source Code

This HTML and jQuery code showcases the usage of the jQuery Multiple Selector to select and manipulate multiple elements with different criteria. Let's break down the code

  • The jQuery Multiple Selector $(".a, #b") is used to select both elements with the class "a" and the element with the ID "b."
  • The .html("Tutor Joes") method is applied to set the HTML content of both selected elements to "Tutor Joes."
  • The .css("color", 'red') method is applied to change the text color of both selected elements to red.
  • Both the <i> element with the class "a" and the <p> element with the ID "b" will have their HTML content set to "Tutor Joes," and their text color will be changed to red.

In summary, the jQuery Multiple Selector ($(".a, #b")) is used to select and perform operations on multiple elements with different criteria. The selected elements have their HTML content changed to "Tutor Joes," and their text color is set to red.

<html>
	<head>
		<title>Mulitiple Selector</title>
	</head>
	<body>
		<h1>Tutor Joes</h1>
		<i class="a">Computer Education</i> 
		<p id="b">Learn More Be Smart</p>
		<script src="js/jquery.js"></script>
		<script>
		$("document").ready(function(){
			$(".a,#b").html("Tutor Joes");
			$(".a,#b").css("color",'red');
		});
	</script>
	</body>
</html>