jquery mobile buttons not working when created dynamicaly

104 views Asked by At

i m using jquery mobile ver. 1.3.0 i want to create a button from jquery from my js file and want to show that button on my page but its not working.

Here is my jquery code to dynamicaly generate button:

<a href="'+ news.link + '" data-role="button" data-theme="a" data-inline="true">View</a>

its only shows the text not the button.

i think its because of the fact that the button is generated dynamicaly so its is unable to found the css in js file.thats why its not showing on page.coz on my page all buttons are working properly.

1

There are 1 answers

1
user700284 On

After adding the button to the DOM,call trigger create method on the page to force JQM to reapply its styles.

$("#pageID").trigger("create");