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

  • SEARCH
  • Home
  • 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 7655161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:26:31+00:00 2026-05-31T12:26:31+00:00

<form id=form1 name=form1 method=post action=> <input type=checkbox id=check1 value=radio /> <label>left</label> <input type=checkbox id=check2

  • 0
<form id="form1" name="form1" method="post" action="">
  <input type="checkbox" id="check1" value="radio" />
  <label>left</label>
  <input type="checkbox" id="check2" value="radio2" />
  <label>right</label>
</form>

I would like to know if the checkbox is checked or not everytime someone clicks on it and then set a variable to the value yes.

if ($('#check1').attr('checked'); ){
var check1 = 'yes'; 
else 
var check1 ='no'
}

this is what I have so far and it doesn’t work
How do I return the value

  • 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-05-31T12:26:33+00:00Added an answer on May 31, 2026 at 12:26 pm

    You don’t need an if-statement to do that. You can use .is(":checked") which will return true if checked and false if not. Assign that value directly to your variable instead of using an if-statement:

    var check1;
    $("#check1").click(function(){
       check1 = $(this).is(":checked");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<form action=/cgi-bin/Lib.exe method=POST name=checks> <input type=checkbox name=user1 value='$NAME'> <input type=checkbox name=user2 value='$NAME'> <input type=checkbox
HTML <form id=contact_form action=# name= method=POST> <label for=name>NAME</label> <input type=text name=name id=name class=contact_form_input />
<form action=next.php method=post> <table> <tr> <td>Paul</td> <td>Attuck</td> <td>paulattuck@yahoo.com</td> <td><input type=checkbox name=list[] value=paulattuck@yahoo.com /></td> </tr>
<form method = post action = <?php echo $_SERVER['PHP_SELF']; ?> /> Username:<input type =
i want insert this form value to datanase : <input type=checkbox name=brand1 id=brand1 value=1>
Getting variable from form: <form method = 'POST' action = ''> <input type =
I have the following email form: <form action=mailer.php method=post name=form1 id=form1 onsubmit=MM_validateForm('from','','RisEmail','name','','R','verif_box','','R','message','','R');return document.MM_returnValue> <table
<form action=/Villa/Add method=post> <table> <tr> <td> Name: </td> <td> <%= Html.TextBox(name) %> <%= Html.ValidationMessage(Name)
Is something like this possible: <form method=post action=myphp.php name=myname target=another_html/iframe_name>??? I want the php
I have set of images and checkboxes like below <form name=food_type_form method=post action=proc.php> <img

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.