0

我有一个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>

我想动态地将“abc”更改为“pqr”。我该怎么做?我试着做 -

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

但它不起作用。我可能做错了什么?

4

2 回答 2

6

.text是一个函数,因此要设置您应该使用的元素的文本,如下所示,

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

于 2012-06-25T17:08:28.670 回答
1
$("#show-notif").html("pqr");

另一种方法:http: //jsfiddle.net/whNdd/

于 2012-06-25T17:11:40.913 回答