.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
dsdgg5

Home >> Code Snippets >> JQuery >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

html5 form validation via JQuery

Posted By:Sasi Prabhu       Posted Date: April 15, 2015    Points: 40    Category: JQuery    URL: http://www.dotnetspark.com  

Check default HTML5 form Validation using jQuery
 


<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js">
</script>
</head>

<body>
  <h1>This is a Heading</h1>
<form>
<input id="txt" type="text" placeholder="Enter Text" required />
<input type="submit" value="submit" /><label id="lbl"></label>
<button id="btnCheck" type="button">Check the Form Validation</button>
</form>

</body>

</html>
jQuery

<script>
$(function(){
$('#btnCheck').click(function(){
$('#lbl').text($('form')[0].checkValidity()); }); }); </script>

checkValidity() - used to Check the Validation status. It will return true/false.

Happy Coding..


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend