Jump to content

zubair439

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by zubair439

  1. When I am clicking reset, the background color in select field is not changing to white. Its displaying the color of the last selected option. Please help me out with this problem. I want to remove the background color too when I am clicking reset button. Thanks in advance for your help.. <body><form><input type="reset" class="resetButton" /><select id="select" style="color: white; width:60px;"onchange="changecolor(select,value)"><option value="white" style="background-color: white; "></option><option value="red" style="background-color: red; color: white;">AB</option><option value="blue" style="background-color: blue; color: white;">BC</option><option value="green" style="background-color: green; color: white;">CD</option><option value="orange" style="background-color: orange; color: white;">DE</option></select></form></body><script>$(function(){$('.resetButton').click(function(){$(this).closest('form').find('select').each(function(){$(this)[0].selectedIndex=0;});});});</script><script language="javascript" type="text/javascript">function changecolor(id,color){id.style.backgroundColor=color;}</script>
×
×
  • Create New...