MeltingDog
MeltingDog

Reputation: 15404

Style JQuery created button with JQuery Mobile CSS?

In my JQ Mobile project I am using JQuery to create a button and append it to a div:

      var input = '<input type="button" class="save_event" value="Save"/>';
      $('.event').append(input);

However, this button seems exempt from Jquery Mobiles styling - it just appears as a normal webkit button. Would anyone know of a way to allow JQM's CSS to style this element?

Upvotes: 2

Views: 87

Answers (1)

Gajotres
Gajotres

Reputation: 57309

You also need to do:

$('[type="button"]').button();

Working example: http://jsfiddle.net/Gajotres/m4rjZ/

If you want to find out more about styling of dynamically created jQM elements take a look at my other answer: jQuery Mobile: Markup Enhancement of dynamically added content

Upvotes: 1

Related Questions