How to find an element attribute through searching for another attribute of that element
<p>I'm trying to access an element's attribute value, by finding a different attribute, by name, of that same element.</p>

<p>Here's some code:</p>

<pre><code>&lt;option data-img-src="http://example.com/pic.jpg" value="Pool Party 21" pdf-data="http://example.com/myPDF.pdf"&gt;&lt;/option&gt;

&lt;img class="image_picker_image" src="http://example.com/pic.jpg"&gt;
</code></pre>

<p>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. </p>

<p>Finally, I try to store that found-elements attribute called "pdf-data" as a string in another variable.</p>

<pre><code>pdfbgImage = $('.tab-pane.active div.thumbnail.selected').children('img').attr('src');
pdfURL = $("[data-img-src=pdfbgImage]").attr('pdf-data');
</code></pre>

<p>I don't believe my code is right. Can anyone help?</p>