jQuery Examples - $("code, em, strong")
Description
"$("code, em, strong")" Selects all elements matched by <code> or <em> or <strong>.
Syntax
Here is the simple syntax to use this selector −
$("element-type1, element-type2, element-type3")
Parameters
Here is the description of all the parameters used by this selector −
element-type1 − element type 1
element-type2 − element type 2
element-type3 − element type 3
Returns
Like any other jQuery selector, this selector also returns an array filled with the found elements.
Example
<html>
<head>
<title>The Selector Example</title>
<script type = "text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
</script>
<script type = "text/javascript" language = "javascript">
$(document).ready(function() {
/* Selects all elements matched by <ul> that follow a sibling element matched by <
p>.*/
$("code, em, strong").css("background-color", "yellow");
});
</script>
</head>
<body>
<h2>Heading level 2</h2>
<code>
alert("Hello World!");
</code>
<h3>Heading level 3</h3>
<em>This is an italic text.</em>
<p>Paragraph</p>
<strong>This is a bold text.</strong>
</body>
</html>
This will produce following result −