I have select box with out onChange
attribute. Now after loading the total page, based on some conditions I have to add onChange
for the select box from Javascript. I am trying with the following code, but its not working:
$("#depositForm").attr(("onChange", "selectedMainDepositType('this');" ));
Its is not adding the onChange
event.
<select id="depositForm_depositSubType" class="depositSubType" style="width:160px;" name="depositSubType">
has to be changed as
<select id="depositForm_depositSubType" onchange="selectedMainDepositType(this);" class="depositSubType" style="width:160px;" name="depositSubType">
Please suggest how to add the onChange
attribute.