Fork me on github

遍历dom节点

 function selectOnchang(obj) {
            var selectedValue = obj.selectedIndex
            if (selectedValue == 0) {
                obj.parentNode.nextSibling.style.display = 'none'
                obj.parentNode.nextSibling.nextSibling.style.display = 'inline'
            }else if (selectedValue == 1) {
                obj.parentNode.nextSibling.style.display = 'inline'
                obj.parentNode.nextSibling.nextSibling.style.display = 'none'
            }
        }
 $("select[name='source_type']").each(function (index, item) {
                            $(this).val(data.cameras[index].source_type)
                            if (data.cameras[index].source_type == 0) {
                                $(this).parent('.form-group').next().hide()
                                $(this).parent('.form-group').next().next().show()
                            } else {
                                $(this).parent('.form-group').next().show()
                                $(this).parent('.form-group').next().next().hide()
                            }
                        })

 

posted @ 2022-12-26 09:56  我の前端日记  阅读(21)  评论(0编辑  收藏  举报
Copyright © 2021 LinCangHai
Powered by .NET 5.0 on Kubernetes