Knowledge Walls
Ammu
Hyderabad, Andhra Pradesh, India
Passcode:
Has method in JQuery of JQuery
1613 Views
Return all <p> elements that have a <span> element inside of them:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("p").has("span").css("background-color", "yellow");
});
</script>
</head>
<body>

<h1>Welcome to My Homepage</h1>

<p>My <span>name</span> is Donald.</p>
<p>I live in <span>Duckburg</span>.</p>
<p>My best friend is Mickey.</p>

</body>
</html>
Next Topics
Next lessons of current book.
JQuery of JQuery
Previous Topics
Previous lessons of current book.
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
Best Lessons of "JQuery"
Top lessons which are viewed more times.
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
JQuery of JQuery
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details