i'm working on a form where you can put your logo as url. I know how to validate a file extension but not a string from a form. i've started with the code i've mentioned here but im totally lost.
<script>
$('#editForm_Submit').click(function (e) {
e.preventDefault();
var re = /^[A-Za-z]+$/;
if(re.test(document.getElementById("LogoUrl").value))
alert('Valid Name.');
else
alert('Invalid Name.');
});
</script>
It has to preventdefault and check the extention on jpg,png and jpeg. if validate than submit else return false.
I've also tried
<script>
jQuery(document).ready(function () {
$('#editForm_Submit').click(function (e) {
e.preventDefault();
jQuery("input[type=url]").each(function () {
jQuery(this).rules("add", {
accept: "png|jpe?g",
messages: {
accept: "Only jpeg, jpg or png images"
}
});
});
});
});
</script>
I know how to do it with php but i want to try it with javascript or jquery