单击按钮后显示表单或其他表单

时间:2020-01-14 14:46:46

标签: jquery show-hide

我有两种不同的形式,modulo-1modulo-2。 1用于预订,2用于取消预订。我需要仅在单击相对按钮后才能显示正确的表单。

单击按钮后,我设法隐藏了不需要的表单,但是我的问题是,当我打开页面时,两个表单都可见。我该如何解决?

jQuery(function() {
  var bottone = jQuery('[class^="bottone"]');
  bottone.click(function() {
    bottone.removeClass('active')
    jQuery(this).addClass('active')
    var numero = jQuery(this).data('numero')
    jQuery('.modulo-' + numero).fadeIn().siblings('[class^="modulo"]').fadeOut()

0 个答案:

没有答案