Wednesday, October 25, 2017

Jquery .end() Method

.end() Method in Jquery:

This method used to end the most recent filtering operations in the chain and return to the old original set of Selected DOM Element
JQUERY:
$(document).ready(function(){
$(‘p’).find(‘span’)             //find span elements inside the paragraphs
.css(‘color’,’red’)          //make span elements content red
.end()                             //move back to the paragraph elements
.css(‘font-weight’,’bold’);  //change font to bold for the paragraphs content
});
HTML:
<p id=”intro”>My name is <span>Prem.</span></p>
<p>I live in chennai.</p>
jquery-end

No comments:

Post a Comment