I have a line of code as follows
if($('#eqInputBox').val().search( $(this).html() ) == -1)
Which is supposed to check to see the html is already in the eqInputBox or not - problem is, sometimes the character in $(this).html() can be a '+' or a '*'. Any other character (in the set of possible characters for the app) works, but when these characters show up, the regular expression doesn't return any value - I think this might be because I can't slip a \ character in to escape these characters.
Anyone have any ideas on how, when the (this) html character is + or *, I can still make it check normally?
EDIT:
$(this).html()
is a user generated div, so I cannot simply put the escape character in manually. How would I go about dynamically adding it when it is necessary?
$('#eqInputBox').val().indexOf($(this).html())is enough.