Friday, May 28, 2021

Slip 4 . Write a jQuery code to disable the submit button until the visitor has clicked a check box.


//slip4.html

 <!DOCTYPE html>
<html>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
      <meta charset="utf-8">
      <title>Disable/enable the form submit button</title>
   </head>
 <body>
   <input id="accept" name="accept" type="checkbox" value="y"/>Upload File<br>  
   <input id="submitbutton" disabled="disabled" name="Submit" type="submit" value="Submit" />
 </body>
 <script>
  $('#accept').click(function() {
if ($('#submitbutton').is(':disabled')) {
    $('#submitbutton').removeAttr('disabled');
    } else {
    $('#submitbutton').attr('disabled', 'disabled');
    }
  });
 </script>
  </html>

No comments:

Post a Comment

Slip 10. Write a jQuery code to make first word of each statement to bold.

  Slip 10. Write a jQuery code to make first word of each statement to bold.  <!DOCTYPE html> <html>   <head>     <scri...