I have a slider, and each slide has content-editable set to true. Meaning, each slide is basically a form. Upon creating a slide, I embed a data-id attribute into each of the slide's fields, so that I can grab the field values from any particular slide.
The problem is, When I grab the field values with a data-id attribute set to 1
it also grabs the field values from the slide with a data-id attribute set to 10
.
Why is this happening?
Here is the code I use to grab any particular slide's values on an event trigger:
var dealID = $(e.currentTarget).data("id");
console.log("Deal ID: " + dealID);
var dealTitleText = $('#deal-main-title[data-id*="' + dealID + '"]').text();
var dealProvider = $('#deal-main-provider[data-id*="' + dealID + '"]').text();
var dealDescription = $('#deal-main-description[data-id*="' + dealID + '"]').text();
var dealPhoneNumber = $('#deal-main-phonenumber[data-id*="' + dealID + '"]').text();
var dealConditions = $('#deal-main-conditions[data-id*="' + dealID + '"]').text();