Can't select <option> - Have tried every thing
Well, this is suppose to happen in the middle of a function... long story short, this function is called in an onChange event of a <select> element.
- <select onchange="DDreorganizeTables(this);" name="pos">
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">Last</option>
- </select>
This is my javascript (sorry for the mess)
take the vars:
thisCurPos = 1
thisNewPos = 3
- jQuery('.DDt_'+_thisCurPos+' > tbody > tr > th > select > option').removeAttr('selected');
- //This will deselect whichever option is selected
- jQuery('.DDt_'+_thisCurPos+' > tbody > tr > th > select > option[value='+_thisNewPos+']').attr('selected', 'selected');
- //This would SUPOSEDLY add the attribute selected to the element
The thing is, ONLY the 'selected' attr doesn't work... if I try .attr('alt', 'something') it works... the only thing that DOESN'T WORK is this... So I presume its nothing wrong with the selector but with the .attr() method
any ideas?