I have this script which checks if the textbox input is an URL.
If the input is correct then it should perform the action.
Problem is, right now the button doesn’t run the action, it just checks if the textbox is a valid URL, and I don’t really understand the code properly.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script type="text/javascript">
jQuery.validator.setDefaults({
debug: true,
success: "valid"
});;
</script>
<script>
$(document).ready(function(){
$("#myform").validate({
rules: {
field: {
required: true,
url: true
}
}
});
$("#field").keyup(function(){
$('#myform').valid();
});
});
</script>
<form id="myform" action="http://google.com">
<label for="field">Required, URL: </label>
<input class="left" id="field" name="field"/>
<br/>
<input type="submit" value="Go" />
</form>
By fiddling with it here: http://jsfiddle.net/jJ7Fh/14/ I found out that it seems to be the
debug: truethat, for some reason, is preventing the normal form execution. Just comment out that line, and it works as it should..