Page 1 of 1

Stumped with selectors

Posted: Mon Mar 26, 2012 12:48 pm
by Lonestarjack
I want to keep the img hidden until an option is selected. Seems simple enough.
It is hidden on the load, but I can't get it to open on the select.

<script type="text/javascript">
$(document).ready(function() {
$("#pic").hide()
});

$("#dropdown.option :selected")(function() {
$("#pic").show()
});
</script>
...
echo '<td><select id="dropdown" onselect="setit(this.options[this.selectedIndex].value)">';
...
echo '<img src="arrow_down.gif" id="pic" width="32" height="30" border="0" onClick="popit()">';

Re: Stumped with selectors

Posted: Tue Mar 27, 2012 6:55 am
by Gopesh
Hi,didn't get the problem well..I made a Jsfiddle check this http://jsfiddle.net/zkMBw/.Hope it helps to solve the problem.

Re: Stumped with selectors

Posted: Tue Mar 27, 2012 9:19 am
by Lonestarjack
Thanks
Works fine. I thought that I had tried your solution before, but I must have messed it up somehow.
Thanks again

Re: Stumped with selectors

Posted: Tue Mar 27, 2012 11:22 pm
by Gopesh
Welcome..Good luck.