作者DarkKiller (System hacked)
看板Ajax
标题Re: [问题] 元素阵列
时间Wed Mar 23 22:53:25 2011
※ 引述《averywu (看文不要只会用横的看)》之铭言:
: 请问要怎麽使用Jquery 选取不特定长度阵列元素呢?
: <input type="text"id="goods[1]">
: <input type="text"id="goods[2]">
: <input type="text"id="goods[3]">
: 其中,goods[X]的X不是固定的,数量也不会固定。
: 我试过 $('#goods[*]').size();
: 是没用的。有什麽比较直接的方法呢?
你的 id 在 html5 是没问题的,但在 html4 是不合规定的:
http://www.w3.org/TR/html401/struct/global.html
id = name [CS]
This attribute assigns a name to an element. This name must be unique in
a document.
http://www.w3.org/TR/html401/types.html#type-name
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by
any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods (".").
如果你能动到 template,修改完 id 後用 class 补上会比较好。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.242.135.97