0
这里是我的代码,它打开窗口上的弹出窗口,名称类似于我的输入值。 它适用于我在html中的第一部分(PASS首先在我的html中),但不适用于其他人。 有什么问题? jquery只打开第一个按钮
</div>
</div>
<!---------------- POLL BUTTON DIV(POP-UP)---------------------->
<div id="modal" class="poll">
<div id="content">
</div>
</div>
<!---------------- PASS BUTTON DIV(POP-UP)---------------------->
<div id="modal" class="pass">
<div id="content">
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#link').click(function(e) { // Button which will activate our modal
var block = $(this +":input").val();
$('.'+block).reveal({ // The item which will be opened with reveal
animation: 'fade', // fade, fadeAndPop, none
animationspeed: 600, // how fast animtions are
closeonbackgroundclick: true, // if you click background will modal close?
dismissmodalclass: 'close' // the class of a button or element that will close an open modal
});
return false;
});
});
</script>
我什至不知道这是怎么工作的,你被强迫DOM元素到一个字符串,并附加一个jQuery psuedo选择器...?你可以在http://jsfiddle.net中提供这个工作的例子。 –
** ID **必须是唯一的。使用**类**形式多个元素。 –