javascript - 如何在 jQuery 中查找元素值

标签 javascript jquery

我试图让所有类调用 Position $(".Position") 并找到 == 4 的值,然后显示 id。

<input type="Text" id="#34" value="1" class="Position">
<input type="Text" id="#22" value="2" class="Position">
<input type="Text" id="#37" value="3" class="Position">
<input type="Text" id="#41" value="4" class="Position">

谢谢

最佳答案

使用Attribute Equals Selector

alert($("input.Position[value='4']").attr("id"));

关于javascript - 如何在 jQuery 中查找元素值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4070743/

相关文章:

javascript - 使用 JSON 的 PHP AJAX 下拉菜单

javascript - div 左侧响应图像固定 100% 高度,div 右侧文本可滚动

jquery - $(window).width 的条件行为

jquery - 我的语法迭代字符串数组有什么问题?

javascript - IE 8 悬停时出现脚本错误

javascript - 如何在TinyMCE 3中隐藏图像描述对话框?

javascript - 函数调用其他函数练习我被难住了

javascript - 如何在不定义变量的情况下使用 document.createElement()

javascript - 如果页面在 JavaScript 执行期间关闭会发生什么?

javascript - 迭代表列并获得最快的时间