Answers for "jquery multiple selectors"

4

jquery or selector

$( "div, span, p.myClass" ).css( "border", "3px solid red" );
Posted by: Guest on May-29-2020
5

jquery multiple selectors

/* 
If we want to apply same functionality and features to more than one selectors then we use multiple selector option.
I think we can say this feature is used like reusability. write a jquery function and just add multiple selectors in which we want same features.


Kindly take a look in below example:
*/
Html:
<div>div</div>
<p class="myClass">p class="myClass"</p>
<p class="notMyClass">p class="notMyClass"</p>
<span>span</span>

Js:
<script>
$( "div, span, p.myClass" ).css( "border", "3px solid red" );
</script>

/*
I Hope it will help you.
Namaste
*/
Posted by: Guest on May-05-2020
-1

how to select multiple jquery element at once

// To select multiple html element at once using jquery, follow the syntax below
$("tagName1, tagName2, tageName3")
// The above code will select "tagName1", "tagName2", tagName3


// To select multiple element using "class name" follow the syntax below
$(".className1, .className2, .className3, .className4")

// To select multiple element using "id name" follow the syntax below
$("#idName1, #idName2")
Posted by: Guest on July-27-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language