1
我寫了一個簡單的彈出式插件,簡單地彈出一個div和黑屏。它以兩種方式工作。簡單的消息和加載ajax。這裏是我的問題訪問當前選定的元素與選項
我有這樣的民意調查的名單:
<div id="pollList" style=" margin-top:10px;">
<li pollId='1'><strong>polling number 1</strong></a><br /><span style='font-size:9px;'>this is a test polling</span></li>
<li pollId='2'><strong>polling number 2</strong></a><br /><span style='font-size:9px;'>this is a test polling</span></li>
現在我想,我的插件適用於所有這李標籤,所以我用這個:
$("#pollList li").popup({
width:800,
height:400,
popupType:'ajax',
ajaxURL:root+'polls/attend/poll/'+$(this).attr('pollId')
});
這裏是我想通過$(this).attr('pollId')到插件來調用相關的URL,但$(this)似乎不工作,並返回'undefined'我怎麼能訪問pollId屬性惠特我n插件選項?
謝謝,這是工作 –