im trying to filter an input text of a form to only allow valid url for webpage, i mean something like example.com would be valid, either with the https field or not
i've been using a function in js to check another domains that i dont want to be valid the function is like that:
function validateWeb(){
var form = document.forms['WebToLeads4207845000109425073'];
var webFld = form.querySelectorAll('[name="Website"]');
if(webFld.indexOf('google.')== -1 && webFld.indexOf('facebook.')== -1 && webFld.indexOf('tiktok.')== -1 && webFld.indexOf('tiktok.')== -1 && webFld.indexOf('instagram.')== -1 ){
return true;
}else{
return false;
}
}
how can i check the url is well composed?