WYSIWYG Editor Alert On Submit To Find Script Tags In HTML Formatter For CKEditor

I am trying to do a validation check after the user tries to insert <script>

a Formatter (HTML) tag for CKEditor.

I'm only doing this for the sake of User Experience as I know the scripts are locked by the awesome editor by default.

My approach is to use Javascript / jQuery and block script tags in the frontend before sending the data as email. However, I'm not sure why this doesn't work. I am attaching the relevant code.

  $("#sendBtn").click(function(){
        $("#messageBody").change(function(){
            if($("#messageBody").indexOf("<script>")  == 1){
                alert("No Script Tags Allowed!");
                return false;
            }   
    });
});

      

I would really appreciate any help on this issue!

+3


source to share





All Articles