Linked Questions

0 votes
0 answers
18 views

Select element in jQuery by using class names [duplicate]

I want to select an element that has all the specified classes. Every time, class names are different. For ex. If specified classes are: A and B Then element which has classes A, B, C, D or A, B ...
ved's user avatar
  • 96
226 votes
4 answers
200k views

Selecting multiple classes with jQuery

I’ve had a good look and can’t seem to find out how to select all elements matching certain classes in one jQuery selector statement such as this: $('.myClass', '.myOtherClass').removeClass('theclass'...
Kieran Senior's user avatar
63 votes
7 answers
142k views

Assigning more than one class for one event

I have an click event that I want to assign to more than class. The reason for this is that I'm using this event on different places in my application, and the buttons you click have different styling ...
holyredbeard's user avatar
  • 20.7k
9 votes
2 answers
18k views

jQuery select an element by multiple css classes

jQuery Class selector works well if you have a single class assigned to an element. What if I assign two classes to an element(Ex: <div class="one two">), how can I find that element if I know ...
dev.e.loper's user avatar
  • 35.8k
6 votes
3 answers
19k views

jquery- store id of clicked link in variable

This should be basic, but for some reason its not working for me. I just want to store the id when a link that has a certain class is clicked in a variable so as an example: <a href="#" id="...
cbr0wn's user avatar
  • 371
4 votes
5 answers
4k views

select element with jquery that has multiple classes

$(".status").attr("rel"); .status can have up to three other additional classes added to it. .online, .away, .offline if I do this: $(".status.online").attr("rel"); it works when status has ...
Dylan Cross's user avatar
  • 5,976
2 votes
1 answer
5k views

Having two class names in a jquery click function

I'm using the class btn1 to control the display of some buttons. I have a click function set up that works fine $('#rotation').on('click', '.btn1'... This calls the same click function for all btn1 ...
Shaun's user avatar
  • 2,131
3 votes
3 answers
3k views

How do I grab elements having different classes using cheerio?

I am scraping bing search results using node and cheerio. I need to grab all the href values from two lists that have different IDs. How can I grab all the tags from both these lists in one statement?...
Rohit's user avatar
  • 1,485
5 votes
6 answers
871 views

jquery test a condition vs entire collection without a loop

Pretty simple to do with loop but I'm wondering if there's a way to see if every item in a collection matches a condition without a loop. For example: if( $('.many-items-of-this-class').hasClass('...
Will's user avatar
  • 5,490
0 votes
3 answers
2k views

Calling a div with two classes in jQuery

I have a div with two classes: <div class="content pager" style="width: 1156px; float: left; list-style: none outside none;"></div> I want to change the element style with jQuery: $("....
Rorshak's user avatar
  • 13
3 votes
2 answers
7k views

Expand collapse all divs at one time

I am using twitter bootstrap css and js frameworks. In this example I have four collapsible divs. when i opened one div then I am clicking expand all button then automatically the opened div is ...
user1931424's user avatar
4 votes
4 answers
1k views

Multiple class selector to wrap div around

I have 2 elements that I want to wrap with a new div. <div class="bigfont-m capsletter"></div> <div class="headfont6 text-overhide"></div> Is it possible to select both ...
anbuteau's user avatar
3 votes
3 answers
1k views

Show/Hide Multiple Div's

What is the best way to add another class to this script: <script type="text/javascript"> $(document).ready(function(){ $('.carlocation').hide(); $('#parking-options').change(...
shayward's user avatar
  • 427
0 votes
2 answers
5k views

Filter based on combination of multiple select and single select elements

I want to filter (show/hide) elements by class. I want to have lets say 5 filters working together. <select id='filter4'>...</select> <select id='filter5'>...</select> <...
mahish's user avatar
  • 1,095
0 votes
6 answers
2k views

Find element in document using HTML DOM

I need to be able to select and modify an element in an HTML document. The usual way to find an element using jQuery is by using a selector that selects by attribute, id, class or element type. ...
Faouzi FJTech's user avatar

15 30 50 per page