0

I have en element with the id ="dk_container_banners[21597][]"

I remember I have to escape square brackets with double backslashes in jquery selectors

So the value of the x variable is : "#dk_container_banners\\[21597\\]\\[\\]"

When I do $("#dk_container_banners\\[21597\\]\\[\\]"), I get results

When I do $(x), I get nothing

Let me provide extra details :

x = ('#dk_container_' + id).replace(/\[/g,'\\\\[').replace(/\]/g,'\\\\]')

Console says value of x is : "#dk_container_banners\\[21597\\]\\[\\]"

After that I do $(x) and i get []

If I do $("#dk_container_banners\\[21597\\]\\[\\]") I get results

ionescho
  • 1,360
  • 2
  • 17
  • 31

0 Answers0