jquery - javascript mirror dropdown selection in another dropdown -


i have 2 forms on page. 1 hidden initially. later, after first form submitted first hidden , second similar more compact form displayed instead.

i want second form loaded same values submitted in first form, have accomplished, except dropdown, causing me issues.

what i'm trying follows:

<select     name        = "chooserep"     id          = "chooserep1"     data-param  = "required"     data-desc   = "report"     onchange    = "document.getelementbyid('chooserep2').options[document.getelementbyid('chooserep2').selectedindex]=this.options[this.selectedindex]">      <option value="">select...</option>     <option value="pandl">profit &amp; loss</option>     <option value="balsheet">balance sheet</option>  </select> 

this doesn't seem have effect. have jquery available, option if knows how.

this should set value,

<select     name        = "chooserep"     id          = "chooserep1"     data-param  = "required"     data-desc   = "report"     onchange    = "document.getelementbyid('chooserep2').value = this.value;">      <option value="">select...</option>     <option value="pandl">profit &amp; loss</option>     <option value="balsheet">balance sheet</option>  </select> 

hope helps.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -