动态替换对话框按钮文本

Suc*_*chi 0 css jquery jquery-dialog

我有一个jquery对话框如下 -

<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>
    <p id="notif-popup-content">Test</p>
    <a href="#notif-details1" id="show-notif" data-role="button">abc</a>
    <a href="#" data-rel="back" data-role="button">Cancel</a>
  </div> 
</div>
Run Code Online (Sandbox Code Playgroud)

我想动态地将"abc"改为"pqr".我该怎么办?我试过 -

$("#show-notif").text = "pqr";
Run Code Online (Sandbox Code Playgroud)

但它不起作用.我能做错什么?

Sel*_*gam 6

.text 是一个函数,所以要设置一个元素的文本,你应该使用如下,

$("#show-notif").text("pqr");