Skip to main content
Rollback to Revision 5
Source Link
Frédéric Hamidi
  • 263.8k
  • 42
  • 497
  • 486

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 

For support of both jQuery and attribute set data values

$("ul").find(function () { return $(this).data('slide') === current }); 

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 

For support of both jQuery and attribute set data values

$("ul").find(function () { return $(this).data('slide') === current }); 

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 
Solution for the problem commented on and upvoted many times.
Source Link
Ben Gripka
  • 16.6k
  • 6
  • 49
  • 43

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 

For support of both jQuery and attribute set data values

$("ul").find(function () { return $(this).data('slide') === current }); 

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 

For support of both jQuery and attribute set data values

$("ul").find(function () { return $(this).data('slide') === current }); 
added 32 characters in body
Source Link

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 
$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 
$("ul").find("[data-slide='" + current + "']"); 

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 

You have to inject the value of current into an Attribute Equals selector:

$("ul").find(`[data-slide='${current}']`) 

For older JavaScript environments (ES5 and earlier):

$("ul").find("[data-slide='" + current + "']"); 
added 45 characters in body
Source Link
mikemaccana
  • 126.1k
  • 113
  • 441
  • 544
Loading
Added ES6
Source Link
Alex Antonov
  • 15.4k
  • 10
  • 75
  • 157
Loading
added 1 characters in body
Source Link
Frédéric Hamidi
  • 263.8k
  • 42
  • 497
  • 486
Loading
Source Link
Frédéric Hamidi
  • 263.8k
  • 42
  • 497
  • 486
Loading