简体   繁体   English

YUI3选择器/查询

[英]YUI3 Selectors / query

There is a list of check boxes in a table and i have assigned a unique key to value attribute of each checkbox. 在表中有一个复选框列表,我为每个复选框的value属性分配了唯一的键。 What should be the selector in YUI3 so that i can get a single checkbox object if I know its value. YUI3中的选择器应该是什么,以便在我知道它的值的情况下获得一个复选框对象。

Following is the sample of the structure: 以下是该结构的示例:

<table id="mytable">
<tr>
  <td><input type="checkbox" value="1" /></td><td>Apple store</td>
<td><input type="checkbox" value="2" /></td><td>Play store</td>
</tr>
</table>

Code required in the following format: Y.one("#mytable input[type=checkbox,value=1]"); 需要以下格式的代码:Y.one(“#mytable input [type = checkbox,value = 1]”);

This must return the checkbox object for Apple Store but its not working.. any idea? 这必须返回Apple Store的复选框对象,但不起作用。

You need an attribute selector for each attribute you are trying to match. 您需要为每个要匹配的属性选择一个属性选择器。 You can't combine the name/value pairs in a single attribute selector. 您不能在单个属性选择器中组合名称/值对。

[type=checkbox][value=1]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM