jQuery how to find an element based on a data-attribute value?
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 + “”]”);