change data-theme dynamically

change data-theme dynamically

Hi,

I am trying to change te dialog theme using below code but it is not changing... why?

here is my div:

  1. <div id="dialogAlert" data-role="popup" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width: 400px;">
  2. <div data-role="header"><h1 id="msgTitle">Error!</h1></div>
  3.     <div role="main" class="ui-content">
  4.     <p id="msgAlert"></p>
  5.     <a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b" data-rel="back">Close</a>
  6.     </div>
  7. </div>

and this is my jquery:

  1. var msg_dialog = document.getElementById('dialogAlert');
  2. msg_dialog.setAttribute('data-theme', 'a');

  3. $('#msgAlert').html("Please enter all required fields!");


Thanks,