2

I'm inserting a form via ajax dynamically into the page. After inserting it into the dom tree, i would like to reinitialize the jquery mobile to style the form. I had a look into http://jquerymobile.com/test/docs/api/events.html but since the documentation is pretty unhelpful for jquery mobile I'm not able to find the correct event.

Philipp Siegfried
  • 976
  • 1
  • 10
  • 14

1 Answers1

8

After you have added the form to the DOM, use .trigger('create'); on the form to initialize any widgets (form elements) you've just added:

...html('<form><input data-role="slider" type="text" /><input type="button" value="button" /></form>').trigger('create');

Here is a demo: http://jsfiddle.net/TBRXk/

Jasper
  • 75,717
  • 14
  • 151
  • 146