【发布时间】:2011-11-18 16:43:22
【问题描述】:
我正在使用 .each 函数获取 div,但我无法将获得的 ID 传递给我的模态框函数。这是代码:
(function() {
$('div.heriyah').each(function() {
$(this).html('<div class="add"><div id="add_button_container"><div id="add_button" class="edit_links">+ ADD NEW CONTENT</div></div></div><div class="clear"></div><div class="placeable"></div></div>');
$('.add').click(function() {
$.fallr('show', {
content : '<iframe width="620" height="600" src="<? echo $URL ?>/manage_content.php?id=<? echo $pageID; ?>&div='+$(this).attr('id')+'"></iframe>',
width : 620 + 5, // 100 = for width padding
height : 600,
closeKey : true,
closeOverlay : true,
buttons : {}
});
});
});
})();
如果我在模态框中请求变量,我会得到 Undefined。
我用这个:
'+$(this).attr('id')+'
在我的模态框函数中获取 id。
谢谢, 鼓手
【问题讨论】: