Skip to main content
Question Unprotected by Amit Joshi
Question Protected by Jeff Atwood
added 8 characters in body; edited tags
Source Link
kd7iwp
  • 3.2k
  • 8
  • 32
  • 41

I have this line of code for page load:

if ($("input").is(':checked')) {

if ($("input").is(':checked')) {

and it works fine when the radio button input is checked. However, I want the opposite. Something along the lines of

if ($("input").not(.is(':checked'))) {

if ($("input").not(.is(':checked'))) {

so that my if statement runs when none of the radiobuttons are selected. What is the best way to go about this?

I have this line of code for page load:

if ($("input").is(':checked')) {

and it works fine when the radio button input is checked. However, I want the opposite. Something along the lines of

if ($("input").not(.is(':checked'))) {

so that my if statement runs when none of the radiobuttons are selected. What is the best way to go about this?

I have this line of code for page load:

if ($("input").is(':checked')) {

and it works fine when the radio button input is checked. However, I want the opposite. Something along the lines of

if ($("input").not(.is(':checked'))) {

so that my if statement runs when none of the radiobuttons are selected. What is the best way to go about this?

added 4 characters in body; edited tags
Source Link
kd7iwp
  • 3.2k
  • 8
  • 32
  • 41

I have this line of code for page load: if

if ($("input").is(':checked')) { and

and it works fine when the radio button input is checked. However, I want the opposite. Something along the lines of if

if ($("input").not(.is(':checked'))) { so

so that my if statement runs when none of the radiobuttons are selected. What is the best way to go about this?

I have this line of code for page load: if ($("input").is(':checked')) { and it works fine when the radio button input is checked. However, I want the opposite. Something along the lines of if ($("input").not(.is(':checked'))) { so that my if statement runs when none of the radiobuttons are selected. What is the best way to go about this?

I have this line of code for page load:

if ($("input").is(':checked')) {

and it works fine when the radio button input is checked. However, I want the opposite. Something along the lines of

if ($("input").not(.is(':checked'))) {

so that my if statement runs when none of the radiobuttons are selected. What is the best way to go about this?

edited tags
Link
Randy
  • 4k
  • 22
  • 25
Source Link
kd7iwp
  • 3.2k
  • 8
  • 32
  • 41
Loading