i do a script like this:
$("#last").bind("change", function() {
var myselect = document.getElementsByTagName("select");
var numselect = myselect.length;
var oldid = "select-" + numselect;
var newidslider = "slider-" + (numselect + 1);
$('#last').attr('name', oldid);
$('#last').attr('id', oldid);
$('#last').selectmenu("refresh", true);
$('#selects').append('<label for="last" class="select">scegli personaggio:</label><select name="last" id="last"><option value="pippo">pippo</option><option value="pluto">pluto</option><option value="paperino">paperino</option><option value="topolino">topolino</option></select><div class="spazio"></div><input type="range" name="' + newidslider + '" id="' + newidslider + '" value="50" min="0" max="100"/>').trigger('create');
});
it work fine when i use app safari mobile or chrome mobile, but when i visit my site after i “added to home screen” the js doesn’t work!
Anyone does know this problem! i’m stuck in this situation!
thanks for attentions!
I’m not sure about anything to do with mobile or “add to homescreen”, but there are a couple of lines in that code that may cause a problem. I am just reading the code, I haven’t run it, so I could be wrong.
That will not find any element to operate on, since the previous line has changed the item’s ID so that it is not “last” anymore.
is creating a new element with the ID “last”, but if you want that to also get the onChange function, you will have to attach it again. The original bind() call only operates on the item that had the ID “last” at the time it was run.