Here is my HTML:
<select name="Pcolor" id="image" style="height:30px;">
<option value="">Избран цвят: Blue/Lt Blue </option>
<option value="45751303" color-number="0">Black</option>
<option value="45751343" color-number="1">Black/Pink</option>
<option value="45751359" color-number="2">Blue/Lt Blue</option>
<option value="45751324" color-number="3">Dk Purple/Purpl</option>
<option value="45751390" color-number="4">Ink/Cerise</option>
</select>
Here is my Javascript:
var ColorSelectt = $('#image').find('option[text="Black/Pink"]').attr("color-number");
alert(ColorSelectt);
All what i want to do is to find the option from select menu with id image
that have text (not value) Black/Pink
for example and then get the value contained in color-number=""
.
When the alert appears it gives me response undefined
, why is that ?
How can i fix it ?