Selecting Element with jQuery
Selecting Element with jQuery
Introduction
Hello,
jQuery uses the XPath syntax to select DOM elements.
So because you are using CSS or if you have used XPath to select nodes in XML, you already know how to select elements with jQuery!
Let's use them with jQuery 🚀
Class Selector
Class Selector
The element in the desired class is selected using the dot(.) operator.
In the example below, It will select all elements and change color which have the title class.
<p class="title">Hello</p>
<p class="title">CoddyKit</p>
<p class="title">Learning</p>
<p class="title">jQuery</p>
<script>
$('.title').css('color','pink')
</script>