.add( selector ) :- Add elements to the set of matched elements

add() method is used to assign some property to some elements .

<html>
<head>
<script src=”http://code.jquery.com/jquery-1.5.js”></script&gt;
</head>
<body>
<p>I am just a paragraph</p>
<span id=”a”>I am span</span>
<script>
$(“p”).add(document.getElementById(“a”)).css(“background”, “yellow”).css(“font-size”, “25px”);
</script>
</body>
</html>

Output :-

Add elements to the set of matched elements

Advertisements

I like to hear from you about this !!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s