I am using jQuery validation plugin URL validation for url validation. I ve added url:true to validate all valid URLs. The Validation plugin is great with the default functions it offers.
It accepts the urls started with http(s).
For example https://www.yammer.com
It throws error when the URL is not started with http(s)
For example www.yammer.com.
JS
$( "#myform" ).validate({
rules: {
field: {
required: true,
url: true
}
}
});
If the entered Url is not started with http(s), I want to add http(s) before validation. I don't want the URL to be validated with regular expressions. Because they are making lot of confusions. How can I add http/https before validation. If the entered URL is started with http(s) there is no problem.
Aucun commentaire:
Enregistrer un commentaire