I'm trying to access an element's attribute value, by finding a different attribute, by name, of that same element.
Here's some code:
<option data-img-src="http://example.com/pic.jpg" value="Pool Party 21" pdf-data="http://example.com/myPDF.pdf"></option> <img class="image_picker_image" src="http://example.com/pic.jpg"> Here's some PHP where I try to get the SRC of that image, store as a variable. Then, try to find another element where the SRC of the image (the previously stored variable) is an attribute called data-img-src that holds that value.
Finally, I try to store that found-elements attribute called "pdf-data" as a string in another variable.
pdfbgImage = $('.tab-pane.active div.thumbnail.selected').children('img').attr('src'); pdfURL = $("[data-img-src=pdfbgImage]").attr('pdf-data'); I don't believe my code is right. Can anyone help?