Similar to the question here , I need to get an element based on its data-id
.
The problem I encounter is that I want to retrieve a an a element with a certain data-id
using a variable.
lets consider the code below:
var item_id = 12345;
if I want to get the element that has the data-id
with the value of item_id, would I do the following ?
$('[data-id=item_id]')
This does not work, and I am kind of stuck on how I can get around this.