javascript - How create dynamically selectmenu in jQuery Mobile? -


i trying dynamically create select element, isn't styled jquery mobile. correct way achieve this?

jsfiddle

here's working jsfiddle example: http://jsfiddle.net/gajotres/dexac/

$(document).on('pagebeforeshow', '#index', function(){         // add new select element         $('<select>').attr({'name':'select-choice-1','id':'select-choice-1'}).appendto('[data-role="content"]');     $('<option>').attr({'value':'1'}).html('value 1').appendto('#select-choice-1');     $('<option>').attr({'value':'2'}).html('value 2').appendto('#select-choice-1');         // enhance new select element     $('select').selectmenu(); }); 

also take @ article, there find different method of enhancing jquery elements markup, or can found here.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -