mr_kmb

URL VALIDA

Jun 16th, 2021
685
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var elm;
  2. function isValidURL(u){
  3.   if(!elm){
  4.     elm = document.createElement('input');
  5.     elm.setAttribute('type', 'url');
  6.   }
  7.   elm.value = u;
  8.   return elm.validity.valid;
  9. }
RAW Paste Data