I'm trying to build a website using jquery-1.10.2
where I want to block css related strings like <style>
, <link>
etc. I want to disable the submit button if any of those strings match. So far I've managed to block them using .keyup()
function but if I write more than those tags like <link rel="stylesheet" href="css/bootstrap.min.css">
then it won't work. Here are my codes,
$(document).ready(function () {
$('#inputdivEditor-2').keyup(function () {
var input = $(this).val();
if (input == "<style>" || input == "</style>" || input == "<link>") {
$('#deactivedivEditor-2').attr("disabled", "disabled");
}else{
$('#deactivedivEditor-2').removeAttr("disabled");
}
});
});
How can I disable the button if any of those strings match from any lines? Need this help badly. Thanks.