Re: [問題] 元素陣列

看板Ajax作者 (System hacked)時間13年前 (2011/03/23 22:53), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串4/4 (看更多)
※ 引述《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
文章代碼(AID): #1DYWbeZn (Ajax)
討論串 (同標題文章)
文章代碼(AID): #1DYWbeZn (Ajax)