Call validate form method

Description

The following code shows how to call validate form method.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.8.3.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css">
<script type='text/javascript'
  src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<script type='text/javascript'
  src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js"></script>
<script type='text/javascript'>
$(window).load(function(){<!--from   w  ww  . j  a  v  a2 s.c  o m-->
    $(document).ready(function () {
        $('#frmResultsForm').validate();
        $('input:radio').change(function (event, ui) {
            $('#frmResultsForm').validate().form();
        });
    });    
});
</script>
</head>
<body>
  <form id="frmResultsForm">
    <div data-role="controlgroup">
      <input type="radio" id="one_1" name="radio-choice" value="0" class="required" /> 
      <label for="one_1">YES</label> 
      <input type="radio" id="two_1" name="radio-choice" value="1" class="required" /> 
      <label for="two_1">NO</label> 
      <input type="text" class="required" />
    </div>
    <input type="submit" value="Submit" action="#" />
  </form>
</body>
</html>

Click to view the demo





















Home »
  jQuery Mobile »
    Example »




Button
Button Event
Button Icon
Button Text
Checkbox
Collapsible
Date
Dialog
Event
Footer
Form
Header
Icon
Input
Layout
Listview
Listview Divider
Listview Item
Loader
mobile_settings
Navbar
Page
Page Event
Popup
Radio
Select
Slider
Switch
Textarea
Theme