Archer
Archer

Reputation: 5147

updating widget in jquery mobile

Looks like jquery mobile initialize widgets on page load using data-XXX tag attributes. for example <a href="#main" data-icon="info" data-role="button">back</a> turns into something like that

 <a href="#main" data-icon="home" class="managable ui-btn-left ui-btn ui-btn-icon-left  ui-btn-corner-all ui-shadow ui-btn-up-a" data-theme="a">
   <span class="ui-btn-inner ui-btn-corner-all" aria-hidden="true">
      <span class="ui-btn-text">back</span><span class="ui-icon ui-icon-home ui-icon-shadow">        
      </span>
   </span>
 </a>

I would like to know HOW to re-generate that widget if I dynamically change some data-XXX attribute? E.g. I'd change data-icon="delete" and would see that this widget is re-generated using new data-icon. Or even changing data-role from "button" to something other. Is there any way?

Upvotes: 0

Views: 1178

Answers (1)

Ahmed Atia
Ahmed Atia

Reputation: 17980

In cases of you're adding something to the page that wasn't already there or when you make a change to an existing element, you need to refresh that element on the page.

Refreshing jQuery Mobile listviews, buttons, select dropdowns, and input fields

Upvotes: 1

Related Questions