jQuery - 动态隐藏/显示对话框上的按钮

标签 jquery css jquery-dialog

我有一个对话-

<div data-role="dialog" id="msg-popup">
  <div data-role="header">
      <h1>Notification</h1>
  </div>

  <div data-role="content" id> 
    <b id="notif-subject"></b>  
    <a href="#notif-details1" id:"show-notif" data-role="button">Show notification</a>
    <a href="#" data-rel="back" data-role="button">Cancel</a>
  </div> 
</div>

我想使用 jquery 代码动态地隐藏和显示 show-notif 按钮。我该怎么做?

我试过了

$("#show-notif").hide(); 

这对我不起作用。有什么想法吗?

最佳答案

似乎有一个小的语法错误:

<a href="#notif-details1" id:"show-notif" data-role="button">Show notification</a>

它应该是(将 : 替换为 =):

<a href="#notif-details1" id="show-notif" data-role="button">Show notification</a>

这些函数应该可以工作:

$('#show-notif').hide();
$('#show-notif').show();

关于jQuery - 动态隐藏/显示对话框上的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11193002/

相关文章:

jquery - 在 jQuery 对话框中时,asp.net 表单控件不可读,如何修复它?

javascript - 我只想在下面的 div 中设置第一行的样式,而不使用内部 div 和 span

html - 某些平板电脑中的响应式导航栏中断

javascript - 如何在每次打开对话框时重新加载包含 jquery 对话框的 iframe 的 src?

javascript - 绘制和删除圆弧 - 使用 JavaScript 或 CSS 的圆弧动画

javascript - React 中的简单轮播 - 如何注册滚动到下一张幻灯片?

jquery 对话框在使用 autoOpen 时有效,但在使用 .click 时无效

javascript - 是否有可能在 Javascript/jQuery 中获取当前鼠标光标的大小?

javascript - Bootstrap 网格 : Is this correct to replace col-xs-6 + col-xs-6 with col-xs-12+ (col-xs-6 & display:none)?

javascript - jQuery 使用 insertAfter 创建的元素不起作用