Edit: I think the issue is not with concatenation itself but the special character in the id of the element I am trying to select.
Original:
I am having problem with concatenating two strings. It seems the problem is because one of the strings contains '!'. Sadly, I have no control over what that string can contain. I tried using '+' to make single string of the two before I tried concat()
. But the error remains the same.
The relevant code is $('#id_online_status_'.concat(msg.id)).removeClass('text-success').addClass('text-muted');
Error is this:
Uncaught Error: Syntax error, unrecognized expression: #id_online_status_specific.YqzvRnpU!OPMxkuoFQILY
Please help with fixing this. I am not much familiar with JS in general.