jQuery('textarea[name="comment"]').keyup(function() { if(isUrl(jQuery(this).val())){ jQuery('input[type="submit"]').attr('disabled', true); }else{ jQuery('input[type="submit"]').removeAttr('disabled'); } }); function isUrl(s) { var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ return regexp.test(s); }
admin Asked question July 27, 2021