Jquery Div Hide on click

时光怂恿深爱的人放手 提交于 2019-12-06 12:32:33

Use show() and hide().

Something to the effect of:

$('#someTabLink').click(function() {
    $('#someImage').show();
});

$('#someOtherTabLink').click(function() {
    $('#someImage').hide();
});

or using toggle():

$('#someTabLink').click(function() {
    $('#someImage').toggle();
});

Use the display css property as opposed to visibility, if you want something to be initially hidden when your page loads, as the jQuery show, hide and toggle methods work by manipulating the display css property.

Could you use something like this in jQuery:

  $("element").addClass("ClassName")
  $("element").removeClass("ClassName")

To remove the class that hides it and add the class which reveales it?

To add to karim79's suggestion, you can make multiple tab links hide the #topleft div like this:

$('#tabb, #tabc, #tabd').click( function() {
    $('#topleft').hide();
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!