Ana*_*pur 4 html javascript forms jquery
Hey everyone, I am trying to hide/show different html elements (div, etc...) based on whether a checkbox is checked or if a specific value is chosen from a dropdown box. I was wondering if someone can help me out. The html element is defined along the lines of this (below), and i'm not sure how to reference it by name with brackets in it. The page i'm using has jquery enabled, and i'd like to use it if possible. Thanks!
<input type="checkbox" name="addons[2]" />
Run Code Online (Sandbox Code Playgroud)
Also - I cannot modify the checkbox's code.
jQuery来检查元素是否被选中:
$("input[name='addons[2]']").attr("checked")
Run Code Online (Sandbox Code Playgroud)
jQuery循环遍历检查的这些元素:
$("input[name^='addons']:checked").each(function() {
// ...
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4520 次 |
最近记录: |