Re: [問題] jquery的attr()在ie中無效

看板Ajax作者 (沉默是金。)時間15年前 (2010/05/17 06:00), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《zoeysui (zoeysui)》之銘言: : 網頁中有許多格式如下的li : 我是想要抓其中一個li的屬性(我自訂的屬性) : <li name="tmb" no="21" pii="3" brf="Test2123456789431354" pth="21.jpg"> : 我用 : $('li[name=tmb][no=21]').attr('brf'); : $('li[name=tmb][no=21]').attr('pth'); : $('li[name=tmb][no=21]').attr('no'); : 甚至 : $('li[name=tmb][no=21]').attr('name'); : 都無法抓到值(印出來是undefine), : 奇怪的是$('li[name=tmb][no='+no+']')是有抓到OBJECT的 : 只有在IE(我只有測IE8)會這樣,FF跟CHROME都很正常 : 不知道有沒有板友知道如何解的,謝謝! 你確定你抓的時候的時間點他是存在的嗎? 我弄了個sample來測試一切正常耶 http://tonyq.org/test/testIE8Attr.php 我常在操作自定義成員,印象中還沒出過錯, 你要不要把完整的error sample 弄上來? 感覺問題應該在別的地方 -- I am a person, and I am always thinking . Thinking in love , Thinking in life , Thinking in why , Thinking in worth. I can't believe any of what , I am just thinking then thinking , but worst of all , most of mine is thinking not actioning... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.137.14.63

05/17 13:16, , 1F
謝謝幫忙,但我發現在JS中把字串加了""之後..就正常了...
05/17 13:16, 1F
文章代碼(AID): #1By6heMl (Ajax)
討論串 (同標題文章)
文章代碼(AID): #1By6heMl (Ajax)