Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:17:00+00:00 2026-06-13T15:17:00+00:00

This code works as I need: $(‘input[class=plus], input[class=minus]’).mousedown(function () { //..doing something }); What

  • 0

This code works as I need:

$('input[class="plus"], input[class="minus"]').mousedown(function () {       
        //..doing something
    });

What I wanted is something like:

$('input[class="plus minus"]').mousedown(function () {            
        //..doing something
    });

or like:

$('input[class="plus"][class="minus"]').mousedown(function () {            
        //..doing something
    });

The selector should choose any input, having either plus class or minus.

There must be some other syntax, but I don’t know one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:17:01+00:00Added an answer on June 13, 2026 at 3:17 pm

    I’d recommend:

    $('input.plus, input.minus').mousedown(function () {            
        //..doing something
    });
    

    …so that other classes on the inputs don’t make you skip them. If you use the attribute equals selector (your input[class="plus"]), it will only match if the only class on the input is "plus". So it would match <input class="plus"> but not <input class="plus foo">. Normally you want the flexibility of having other classes on the element.

    Alternately, you could do this:

    $('input').filter('.plus, .minus').mousedown(...);
    

    …but it would be likely to be less efficient: First it would make jQuery look up all input elements, and then separately filter the result to just the ones with those classes. So I wouldn’t recommend it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing something with XML and now I'm confused. This code works perfectly: QDomElement
Please i need help, this code below works fine on my localhost, php5.3+ but
This code works (when ControlType=dropDown then the background yellow ): <Window x:Class=TestCollapsed.Views.MainView xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I need to fill the ListView with AsyncTask. This code works, the TextView changes
I need some help with virtual attributes. This code works fine but how do
This code works properly in Firefox but not in Chrome, If you need more
this code works fine but my problem is that i need to read the
This code works perfectly ok, but what if I need the searched item be
This code works as a is in the same scope where eval runs: function
This code works fine in Firefox and IE. In Chrome, you need to click

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.