![](/img/trans.png)
[英]javascript toggle function to hide and display text - how to add images
[英]How to display text when we toggle in javascript?
我想在用戶單擊圖標時顯示文本。 我有以下代碼塊,但這是錯誤的。 有人可以糾正我嗎:
<a class="icon-question-sign help_popup"
onclick="javascript:$('#callback_help').toggle('fast', function() {
$('#callback_help').html('xx');
})">
</a>
如果您未包括jQuery庫,則必須包含它:
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
其次,您可以嘗試這樣:
HTML:
<a class="icon-question-sign help_popup"></a>
<div id="callback_help"></div>
jQuery的:
<script type="text/javascript">
$(document).ready(function(){
$('.help_popup').click(function(){
$('#callback_help').toggle('fast', function() {
$('#callback_help').html('xx');
});
});
});
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.