Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(function() {
- $("#test_form").find("#submit_button").click(function(){
- if ($.trim($("#test_form").find("#first_name").val()).length == 0 || $.trim($("#test_form").find("#last_name").val()).length == 0){
- alert("Incorrect format!");
- } else {
- $('#test_form').submit();
- }
- });
- });
- </script>
- <form id="test_form" action="/page.php">
- First name:<br>
- <input type="text" id="first_name"><br>
- Last name:<br>
- <input type="text" id="last_name"><br><br>
- <input type="button" id="submit_button" value="Submit">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement