javascript - Show select box options based on link -


i have jsp page. created links.

<div align="center" style="border: 1px solid #ddd; position:absolute;left:20px; top:100px; width: 150px;">     <br>     <a class="applicationdata" href="#" id="1">organization data</a><br>     <a class="applicationdata" href="#" id="2">business units</a><br>     <a class="applicationdata" href="#" id="3">applications</a><br>     <a class="applicationdata" href="#" id="4">data entity</a><br>     <br> </div> 

similar have created many links. , have select box

<label class="control-label" for="dataloadtype">data load type:</label> <select id="dataloadtype" name="dataloadtype">     <option value="fromdb">from database</option>     <option value="fromfile">from file</option>     <option value="email">e-mail</option>     <option value="webservices">web services</option> </select> 

what want is, when click on organization data, select box should display first , second options only(from database & file), if select business unit, want display next 2 options only, if select third one, need display options , if click on last link, should display first , third option only. if there 2 or 3 links have used many select boxes, have more 20 links. difficult code common options.

so there way can achieve this? can give idea?

thanks

if want show options in scope can create hidden select containing options , option "type" stored class:

<option class="organization applications data" value="fromdb">from database</option> <option class="organization applications" value="fromfile">from file</option> <option class="business applications data" value="email">e-mail</option> <option class="business applications" value="webservices">web services</option> 

you can add "type" links data attribute:

<a data-selecttype="organization" class="applicationdata" href="#" id="1">organization data</a><br> <a data-selecttype="business" class="applicationdata" href="#" id="2">business units</a><br> <a data-selecttype="applications" class="applicationdata" href="#" id="3">applications</a><br> <a data-selecttype="data" class="applicationdata" href="#" id="4">data entity</a> 

and on link click clone them desired select.

example here http://jsbin.com/otocum/1/


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 -