Suchi
Suchi

Reputation: 10039

Replace dialog button text dynamically

I have a jquery dialog as follows -

<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>

I want to change "abc" to "pqr" dynamically. How would I do that? I tried doing -

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

But it does not work. What could I be doing wrong?

Upvotes: 0

Views: 78

Answers (2)

SVS
SVS

Reputation: 4275

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

Another way to do this: http://jsfiddle.net/whNdd/

Upvotes: 1

Selvakumar Arumugam
Selvakumar Arumugam

Reputation: 79830

.text is a function and so to set a text of an element you should use like below,

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

Upvotes: 6

Related Questions