見下面是我試過的。如何使用jquery創建一個彈出窗口onclick
的jQuery:
$("#type_name").click(function(){
$("#add_form").fadeIn(1000);
$("#involved_name").val("");
positionPopup('#add_form');
$("#involved_name").focus();
});
HTML:
<button type="submit" name="edit" class="forward" id="type_name"><font color="#026BE2">Type a name </font></button>
上面的代碼不工作,不顯示在控制檯中的任何錯誤,但彈出:對HTML
<div id="add_form" style="display:none">
<h2>Enter involved Name<h2>
<table><tr><td>
<input type="text" id="involved_name" name="name" maxlength="20" /></td></tr>
</table>
<div style="width:180px;margin:20px 5px 0 10px" align="right">
<button type="button" class="close" name="cancel" class="forward backicon">
<img src="{{ STATIC_URL }}images/button-icon-ir-back.png" width="12" height="17" alt="" />
Cancel</button> {% include "buttons/add.html" %}
</div>
</div>
的onclick按鈕不顯示。需要幫助。
我沒有在這裏看到任何問題,在這個小提琴中工作正常。 http://jsfiddle.net/a6tLh/我的猜測是你先分配點擊監聽器然後渲染按鈕。嘗試相反的方式。 –
對於我以前使用名爲[tooltipsy](http://tooltipsy.com/index)的插件的工具提示。我試了一堆tooltip插件,其中一個是最好的。大多數其他工具提示插件都有限制,但是那個允許我輕鬆做任何事情。 –
試着把你的代碼放在一個'$ .ready'裏面,或許 – Alexander