简体   繁体   中英

HTML Dropdown list without changing selected value

I have a HTML/JS dropdown list - I would like the default text in the dropdown box to stay the same even when the dropdown list is changed to navigate elsewhere; please help?!

my code:

    <select name="me" id="me" data-theme="a" data-icon="grid" data-inline="true" data-native-menu="true" onchange="if (this.value) window.location.href=this.value">
        <option value="" selected>DEFAULT TEXT</option>
        <option value="#option1">Option1</option>
        <option value="#option2">Option2</option>
        <option value="#option3">Option3</option>   
    </select>

try this:

<select name="me" id="me" data-theme="a" data-icon="grid" data-inline="true" data-    native-    menu="true" onchange="if (this.value) window.location.href=this.value">
    <option value="" selected="true">DEFAULT TEXT</option>
    <option value="#option1">Option1</option>
    <option value="#option2">Option2</option>
    <option value="#option3">Option3</option>
</select>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM