The plugins site is currently in development.
We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.
Handle select inputs intuitively.
| Project: | Jeditable - In Place Editor plugin |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | tuupola |
| Status: | closed |
Jump to:
jEditable currently handles select inputs very awkwardly. it doesn't select the selected element, nor respect the value of the initial div as the default/initial selected item. attached is an patched version of the plugin that handles this stuff intuitively.
| Attachment | Size |
|---|---|
| jquery.jeditable.js_.txt | 16.71 KB |
- Login to post comments

Comments
#1
Can you clarify what you mean by
?
#2
Can you clarify what you mean by "doesn't select the selected element"?
#3
Imagine you have a select menu with the options of Apple and Banana, in your jeditable config you put
data : "{'APPLE':'Sour Apple','BANANA':'Ripe Banana', 'selected':'APPLE'}"
All good there. Then you go and edit the menu once and change the selected value to BANANA. Still fine. But, then you go to edit it once more and when it changes from a simple div to the select menu, you see that the value is now 'APPLE' again. This is confusing to me and my users. To fix this, i believe you just need to change:
/* Loop option again to set selected. IE needed this... */
$('select', this).children().each(function() {
if ($(this).val() == json['selected']) {
$(this).attr('selected', 'selected');
}
});
to
/* Loop option again to set selected. IE needed this... */
$('select', this).children().each(function() {
if ($(this).val() == json['selected'] ||
$(this).text() == original.revert) {
$(this).attr('selected', 'selected');
}
});
This also has the added benefit of making the 'selected':'APPLE' setting in the data unnecessary, as it will pick up the original value of the that you make editable.
#4
So, what do you think? Will this be included?
#5
Fixed in latest (1.5.6). Download from:
http://www.appelsiini.net/download/jquery.jeditable.js or
http://www.appelsiini.net/download/jquery.jeditable-1.5.6.js
#6