(I'm sorry if this is a FAQ, I didn't see anything in the search..I'm using IE)
With JQuery's plan to focus 2.x on efforts to move the project forward without legacy browser baggage, will the JQM project attempt the same idea to match alignment and community support efforts?
1.x - branch for legacy browsers and devices
2.x - branch for moving forward with JQ 2.x
I'm really really hoping the answer is "YES" or "possibly" :P
We were running into an issue with JQM where native multiple select inputs (using selectmenu) were not properly showing an empty default value.
We didn't like using a placeholder, as it becomes a selectable option in the list which we would then have to add logic for to remove during form validation / submission.
Here's what we came up with, hope it helps someone out there (or even better hopefully it's allowed into the project)..
We updated setButtonText of the selectmenu plugin:
var val = self.placeholder;
if(self.options.hidePlaceholderMenuItems){ val = ''; }
Hey all, I'm pulling my hair out trying to make sure that a dynamically built multiple select input using native menus is showing a null / blank value for its default text.
In the pageshow event for the DIV, I'm clearing the select input, filling it with data, then trying to set the default text to empty if there's no selected value.
//clearing code - seems to work fires within the pageshow event
var selectItems = $("#select-thing");
//clear our multiple select entries in the list
$('#select-thing').attr('selectedIndex', '-1');
selectItems.val(null);
selectItems.empty();
//sync the object data with the jquery menu object
selectItems.selectmenu('refresh', true);
So far so good. The list appears to be cleared. Next I fill it using
Next I want to make sure that there's no option selected and the default text value for the list is empty / null.
var selectItems = $("#select-thing");
$('#select-thing').attr('selectedIndex', '-1');
selectItems.val(null);
selectItems.selectmenu('refresh', true);
After all this, the options are correctly not selected, however somehow the default value is only null on the first rendering of the page. Each subsequent visits to this page, somehow retains the chosen value...
btw. this seems to work correctly with the non-native menus.