How to change value for selectmenu? On click of button I need to reset to default value like this.
$j('#mm').val('mm');
$j('#mm').selectmenu('refresh', true);
I looks like the value is changed, but I have the problem with the width of select menu, it becomes too small. How to update value without change widith of element?
This code cause javascript error no such method:
$('#mm').selectmenu("value", 'mm');
It can be solved like this one:
$j('#mm-button .ui-selectmenu-text').text('mm');
$j('#dd-button .ui-selectmenu-text').text('dd');
Related
I'm getting an issue on a picker view. When the picker is opened I would like the focus to be on the active value that is 70 instead of 42. I have used generic attribute like selected for this purpose but no luck.
Screenshot
Any idea how to solve this please?
Thanks
you can set the default selected value by the following method. (in below code, 1 is the index of the row you want to select)
picker.selectRow(1, inComponent:0, animated:true)
I am using Polymer paper-tabs - all working fine.
I want to programmatically select a paper-tab, and show it as selected/highlighted. Functionally there is no problem, but the tab is not showing "the correct colour" (=as highlighted).
I have used:
PaperTabs mypaperTabs=...
mypaperTabs.selected = "#mytab';
and
myTab.click();
The previously selected tab does correctly become unselected. So it is showing as all tabs as unselected. Is there something else I should be doing?
You need to assign the number of the tab to selected not the value of the id attributed.
For example:
mypaperTabs.selected = "1';
I try to develop a selectMenu with image? I take exemple on jquery ui site and modify to add possibility to keep picture visible when you selected item with picture.
Here My code
My problem is on reset. Sometimes I need to put it in initial state.
I try refresh, but there is an automatic add of With on Span result and my select change size. I correct it on create event
widget.css({ 'width': '' });
But don't Work in select event... and when I click on reset my select become smaller.
Then I try destroy event. Good for the size but not for the text display. If I select an item with picture.
Click on reset
When I put break Point :
$(this).children(":first")
return the good item (text=TOUS") But it keeps old selected value to display text and display nothing
I don't know do to refresh correctly my selectmenu and return in first state
If debugging is the art of removing bugs ... then program is the art of creating
I am writing a script using jQueryUI's button http://jqueryui.com/dialog/#modal-form.
The button is pretty fancy looking.
Now, when I tried to use jQuery to change the display name of the button:
$('#signin').text("new name");
The Button revert to the original style of the browser, with no padding and etc. I don't know why change of style happens when I just change the display name of the button. Please suggest me a way to fix it.
To change button text use this :
$('#btnId').val('new-text');
I figured out how. I used a span tag around the display name and just change text of that span tag.
I have this case where I set a current item from a list and I need to use a textarea to edit that element's value.
Because of some constraints I have to use a keyup event but I don't think that's a problem.
Check this fiddle: http://jsfiddle.net/terebentina/Euj2C/
click on first/second buttons - it works, it changes the text in the textarea to the value of each element.
change the text in the textarea to something
click on the first/second buttons again - the textarea is not updated anymore. If you look in console, you can see that it switches between the elements, it's just that the textarea is not updated anymore.
Any suggestions? this is driving me nuts!
I know there is a better way modifying your directive to do this but as a quick fix for now you can try binding your textarea to a ngModel value that is just a copy of the current text in the selected element:
<textarea keyup="" ng-model="keyupText"></textarea>
With this in as your current function:
$scope.current = function(idx) {
$scope.current_element = $scope.elements[idx];
$scope.keyupText = $scope.current_element.value;
console.log('current is', $scope.current_element.value);
}
See this fiddle for an example.