Question

I have a project about Language School Website. It has lots of dealers.

If users select dealers, then click about us, I want redirect to about us page of SELECTED dealers.

How can I solve this problem using jQuery?

Thank you

<div class="blueBox">
    <h2 class="title">Dealers</h2>
    <span class="sortArea clearfix">
        <a href="#" class="blueBt Bt">All Dealers</a>
        <!--scroll dropdown-->
        <form >
            <select id="e1">
                <option value="Education Center">Education Center</option>
                <option value="Yenimahalle">Yenimahalle</option>
                <option value="Demetevler">Demetevler</option>
            </select>
        </form>
        <!--scroll dropdown-->
    </span>
    <div class="detail clearfix">
        <h3 class="subTitle">Şube Seçiniz</h3>
        <ul class="detailLinks">
            <li><a class="one Bt" href="#">About US</a></li>
            <li><a class="two Bt" href="#">Pictures</a></li>
            <li><a class="three Bt" href="#">Personal</a></li>
            <li><a class="four Bt" href="#">Contact Us</a></li>
        </ul>
    </div>
</div>
Était-ce utile?

La solution 2

$("#aboutUsLink").click(function(){
  selected = $("option:selected","#e1").attr("value");
  window.location.href = aboutPage(selected);
})

http://api.jquery.com/selected-selector/

Autres conseils

if you have a option list of dealers and you want that clicking on about us
go to the right page check this simple code

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://pvp.comeze.com/cms/js/jquery.dotdotdot.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('select').on('change',function(){
        var links=$('#dealers option:selected').attr('value')
        if(links){
            $('#about').attr('href',links)
            }
        })
})
</script>

</head>
<body>
<select id="dealers">
    <option>select</option>
    <option value="about us1.html">dealer 1</option>
    <option value="about us2.html">dealer 2</option>
    <option value="about us3.html">dealer 3</option>
</select>
<a href="" id="about">about us</a>
</body>
</html>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top