soarli

layui中选中select标签触发事件
html核心代码<select name="leixing" lay-filter=&q...
扫描右侧二维码阅读全文
20
2021/10

layui中选中select标签触发事件

html核心代码

<select name="leixing" lay-filter="leixing">
                <option value="xxxxx">xxxxx</option>
                <option value="lastten">最近十位</option>
                <option value="xxxxx">xxxxx</option>
                <option value="xxxxx">xxxxx</option>
                <option value="xxxxx">xxxxx</option>
                <option value="xxxxx">xxxxx</option>
                <option value="xxxxx">xxxxx</option>
                <option value="xxxxx">xxxxx</option>
            </select>

JavaScript核心代码

var form = layui.form;
form.on('select(leixing)', function(data){ 
    if(data.value == 'lastten'){ //如果选择“最近十位”
        window.open('../last_ten/','_self'); // 直接跳转
        document.getElementById("fangfa").style.display = "none"; //可用以隐藏
        document.getElementById("neirong").style.display = "none"; //可用以隐藏
        document.getElementById("buttons").style.display = "none"; //可用以隐藏
    }else{
        document.getElementById("fangfa").style.display = "block"; //可用以显示
        document.getElementById("neirong").style.display = "block"; //可用以显示
        document.getElementById("buttons").style.display = "block"; //可用以显示
    }
}); 

参考文章:

https://www.cnblogs.com/tine/p/8257304.html

https://blog.csdn.net/weixin_30715523/article/details/99783895

https://cloud.tencent.com/developer/article/1409115

最后修改:2021 年 10 月 22 日 03 : 38 PM

发表评论