如何使用jquery切换div? [英] How to toggle a div using jquery?
问题描述
Hii,
$(document).ready(function(){
$( '#showHide')。toggle(function(){
$(this).val('Show');
$('#divComments')。hide( );
},function(){
$(this).val('Hide');
$('#divComments' ).show();
});
});
我正在上面的代码...因为我在document.ready中编写代码,它首先自动隐藏div ...如果我删除document.ready它将无法工作.. plz建议
Hii ,
$(document).ready(function () {
$('#showHide').toggle(function () {
$(this).val('Show');
$('#divComments').hide();
}, function () {
$(this).val('Hide');
$('#divComments').show();
});
});
I am doing above code ... since i am writing code inside document.ready its automatically hidding the div at first ... and if i remove document.ready it wont work .. plz suggest
推荐答案
(document).ready(function(){
(document).ready(function () {
('#showHide')。 toggle(function(){
('#showHide').toggle(function () {
(this).val('Show');
(this).val('Show');
这篇关于如何使用jquery切换div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!