I have a div with id as masterResourceFor_R&D
. But when I use this ID in jQuery to select this div
and put a click function on it, it doesn't work. I think the problem is because of the symbol &
in ID. I do not have any option to rename the ID.
How can I use this ID in jQuery?
transitive verb. 1 : to put into action or service : avail oneself of : employ. 2 : to expend or consume by putting to use —often used with up. 3 : stand sense 1d the house could use a coat of paint. 4 : to consume or take (liquor, drugs, etc.)
verb (used with object), used, us·ing. to employ for some purpose; put into service; make use of: to use a knife. to avail oneself of; apply to one's own purposes: to use the facilities. to expend or consume in use: We have used the money provided.
An exploiter is a user, someone who takes advantage of other people or things for their own gain. Being an exploiter is selfish and unethical. To exploit someone is to use them in a way that's wrong, like an employer who pays low wages but demands long hours.
You can escape the character using backslashes (\
).
#masterResourceFor_R\&D { ... }
$('#masterResourceFor_R\\&D');
JSFiddle demo.
Ignore using special characters as id's and class names, change it if you can, if you can't and you want to solve this mess, you need to escape that character
#masterResourceFor_R\&D {
color: red;
}
Demo
Reference
In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With