jQuery Test if checkbox is NOT checked

0 votes

I'm having trouble figuring this out. I have two checkboxes (in the future will have more):

  • checkSurfaceEnvironment-1
  • checkSurfaceEnvironment-2

Basically, I want to write an if statement and test if one of them is checked and another is NOT checked. What's the easiest way to accomplish the following:

if ( $("#checkSurfaceEnvironment-1").attr('checked', true) &&
     $("#checkSurfaceEnvironment-2").is('**(NOT??)** :checked') ) {
        // do something
}

Jun 29, 2022 in Web Development by gaurav
• 23,260 points
492 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Web Development

0 votes
1 answer

Check if checkbox is checked with jQuery

To check whether a Checkbox has been ...READ MORE

answered Jun 23, 2022 in Web Development by rajatha
• 7,640 points
909 views
0 votes
1 answer
0 votes
1 answer

Not able to show/hide div which is nearest to checkbox using JQuery

pretty simple: $('.check-hide-show-content').hide(); // hide all content divs // ...READ MORE

answered Aug 2, 2022 in Web Development by rajatha
• 7,640 points
1,111 views
0 votes
1 answer

Loading gif in jQuery ajax call is not showing

Create a div with your image. Make it ...READ MORE

answered Jun 27, 2022 in Web Development by rajatha
• 7,640 points
1,247 views
0 votes
0 answers

How to check radio button is checked using JQuery?

I have two radio buttons in one ...READ MORE

Jun 29, 2022 in Web Development by gaurav
• 23,260 points
284 views
0 votes
0 answers

jQuery(...).iris is not a function

I am trying to implement color picker ...READ MORE

Jul 28, 2022 in Web Development by gaurav
• 23,260 points
474 views
0 votes
1 answer

jQuery if checkbox is checked

for jQuery  if ($('input.checkbox_check').prop('checked')) { ...READ MORE

answered Jun 20, 2022 in JQuery by rajatha
• 7,640 points
242 views
0 votes
1 answer

Jquery - Using .each() with variables and an IF statement

To get values from elements, you need ...READ MORE

answered Jun 21, 2022 in JQuery by rajatha
• 7,640 points
2,810 views
0 votes
0 answers

jQuery if checkbox is checked

I have a function below that I ...READ MORE

Jun 29, 2022 in Web Development by gaurav
• 23,260 points
326 views
0 votes
0 answers

Meaning of if(something.length) in jQuery

I was parsing some smooth-scrolling code online ...READ MORE

Aug 11, 2022 in Web Development by gaurav
• 23,260 points
394 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP