0

I have something like .class and I use this as the id of a div element:

<div id=".class">...</div>

But I can't use this selector:

$("#.class")...

If I remove the . before class, it is impossible because the .class comes from a dynamic code.

I want some way to force the string after # to be selective.

Perhaps the solution may look something like this:

<div id="<.class>"...
Keavon
  • 6,837
  • 9
  • 51
  • 79
ConductedClever
  • 4,175
  • 2
  • 35
  • 69
  • Escape it with \\ maybe ... And if it's not working it's because the id ".class" is not correct according [this](http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier) – Ko2r Aug 07 '14 at 21:17
  • 1
    why not remove the dot programmatically? – Kolby Aug 07 '14 at 21:18
  • Couple of things about your question: 1) id's can't start with `.` 2) there should be an = sign between `id` and `.class` like `
    ` 3) given the = sign is in the right spot you could use something like this `$('div[id=".class"]')`
    – cjav_dev Aug 07 '14 at 21:20

0 Answers0