Im using jqtransform plugin.
<label>Select Redimentionné :</label>
<select name="select2" class='mySelect'>
<option value="opt1" onclick="clickme(1)">Big Option test line with more wordssss</option>
<option value="opt2" onclick="clickme(2)">Option 2</option>
<option value="opt3" onclick="clickme(3)">Option 3</option>
<option value="opt4" onclick="clickme(4)">Option 4</option>
<option value="opt5" onclick="clickme(5)">Option 5</option>
<option value="opt6" onclick="clickme(6)">Option 6</option>
<option value="opt7" onclick="clickme(7)">Option 7</option>
<option value="opt8" onclick="clickme(8)">Option 8</option>
</select>
<ul style="width: 253px; display: none; visibility: visible;">
<li style=""><a index="0" href="#" class="">Big Option test line with more wordssss</a></li>
<li><a index="1" href="#" class="">Option 2</a></li>
<li><a index="2" href="#" class="">Option 3</a></li>
<li><a index="3" href="#">Option 4</a></li>
<li><a index="4" href="#" class="selected">Option 5</a></li>
<li><a index="5" href="#">Option 6</a></li>
<li><a index="6" href="#">Option 7</a></li>
<li><a index="7" href="#">Option 8</a></li>
</ul>
I want to add this click event to li with this:
$(document).ready(function(){
$('.mySelect option').each(function(){
//alert($(this).attr('onclick'));
var att = $(this).attr('onclick');
$('jqTransformSelectWrapper ul').find('a').attr('att');
});
});
But a has not any onclick attr. How can I assign option attribute to a?
Thanks in advance
I'm still working out your request in alignment with the code provided, but considering that what you want is this:
So, to walk through and try to be sure this is what you want, we take the
onclick
attribute of theoption
and apply it thea
elements; however, what you probably want is to be more specific with the link you're selecting, perhaps using an index, for instance:Where you'd need to use the
index
argument that would be supplied as a parameter of theeach
call - the signature of which would look like this: