gpt4 book ai didi

jquery - 通缉 : 'Super selector' or How focus the first visible "input" field that has no value?

转载 作者:搜寻专家 更新时间:2023-10-31 02:25:49 25 4
gpt4 key购买 nike

我想知道是否有可能只使用一个 jQuery 选择器 来聚焦第一个空的可见“输入”字段:类似于 $('superamazingselector' ).focus();

“输入”字段是指:文本区域输入(不是 type="hidden")、选择单选按钮未选中的复选框字段。我想这个“ super 选择器”在很多页面上都会非常方便。

最佳答案

试试这个(未经测试):

$(':input[value=""]:visible:not(:button):first, :checkbox:not(:checked):first').first().focus();

如何选择单选按钮取决于 <input type="radio" /> 的 HTML 结构,我想不出一个通用的选择器来检测未选中的单选按钮组。

关于jquery - 通缉 : 'Super selector' or How focus the first visible "input" field that has no value?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4781498/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com