Skip to main content
Escape a string for use as part of a selector
Source Link

Without JQuery, ES6

document.querySelectorAll(`[data-slide='${CSS.escape(current)}']`); 

I know the question is about JQuery, but readers may want a pure JS method.

Without JQuery, ES6

document.querySelectorAll(`[data-slide='${current}']`); 

I know the question is about JQuery, but readers may want a pure JS method.

Without JQuery, ES6

document.querySelectorAll(`[data-slide='${CSS.escape(current)}']`); 

I know the question is about JQuery, but readers may want a pure JS method.

Source Link
rap-2-h
  • 32.3k
  • 49
  • 190
  • 281

Without JQuery, ES6

document.querySelectorAll(`[data-slide='${current}']`); 

I know the question is about JQuery, but readers may want a pure JS method.