Append text when checkbox is checked - Javascript jQuery

Javascript examples for jQuery:Form Checkbox

Description

Append text when checkbox is checked

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> 
 </head> /*  w  w w. jav  a  2  s .c o  m*/
 <body> 
  <form id="vcardForm" method="post"> 
   <input id="chkbox1" type="checkbox"> 
   <label id="lbl1"></label> 
   <input type="submit" id="submitbtn"> 
  </form> 
  <script>
$("#chkbox1").change(function(){
  $('#lbl1').text("Checked is "+ this.checked +"!");
});

      </script>  
 </body>
</html>

Related Tutorials