Webmaster Forums - Website and SEO Help

Web Development and Design => Website Design and HTML => Topic started by: mvminfotech on October 03, 2018, 01:08:05 AM

Title: what is the difference between ID selector and class selector in jQuery?
Post by: mvminfotech on October 03, 2018, 01:08:05 AM
what is the difference between ID selector and class selector in jQuery?
Title: Re: what is the difference between ID selector and class selector in jQuery?
Post by: Netparticle on October 22, 2018, 01:25:36 AM
ID's should be unique on the page when you have multiple elements with same ID's, jQuery selects only the first one. That's because it doesn't have to bother looking for others as there isn't supposed to be anymore – that might explain the weird behavior you're experiencing.
If you want multiple elements to have the same functionality, give them the same class. If you want to identify a specific element, give it an id. This isn't limited to just jQuery, but to HTML and CSS overall.
Title: Re: what is the difference between ID selector and class selector in jQuery?
Post by: Citywebpuneind on November 08, 2021, 08:17:15 AM
Difference between id and class attribute: The only difference between them is that "id" is unique in a page and can only apply to at most one element, while "class" selector can apply to multiple elements