Loading a URL when dropdown option Changes in YUI

孤者浪人 提交于 2019-12-11 23:57:32

问题


I am trying to load a URL when a drop down menu changes via YUI Change event. I just want to navigate to that URL.

I made a long search. But didn't got any way.

Thanks :)


回答1:


<select id="dropdown">
    <option value="http://example.com/home">Home</option>
    <option value="http://example.com/about">Abount</option>
</select>


Y.one("#dropdown").on("change", function() {
    //'this' points to dropdown node
    //so it's value is a value of selected option. Assume you keep new url there
    document.location.href = this.get('value'); 
});


来源:https://stackoverflow.com/questions/18490592/loading-a-url-when-dropdown-option-changes-in-yui

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!