admin管理员组文章数量:1302379
in my x-editable field I have a textarea that I want to update based on the returned value. This works when I use $(this).html(newVal);
as shown below
success: function(response, newValue) {
newVal=unescape(JSON.parse(response).VALUE)
$(this).html(newVal);
}
the problem is when I click to edit the field the second time, the value inside the input object (class: editable-input
) stays the same as it was when it was sent. Is there a way to fix this?
in my x-editable field I have a textarea that I want to update based on the returned value. This works when I use $(this).html(newVal);
as shown below
success: function(response, newValue) {
newVal=unescape(JSON.parse(response).VALUE)
$(this).html(newVal);
}
the problem is when I click to edit the field the second time, the value inside the input object (class: editable-input
) stays the same as it was when it was sent. Is there a way to fix this?
2 Answers
Reset to default 7the simplest way:
$('.textarea').editable({
success: function(response, newValue) {
return {newValue: response.newValue};
}
}
});
remember to return newValue variable in response content:
{"newValue":"some_string_new_value"}
this worked. I'm setting the value by calling this function in the on success
callback
function formatXEditable($item, $val){
$val = $val.replace(/<br\s*\/?>/mg,"\n");
$($item).on('shown', function(e, editable) {
editable.input.$input.val($val);
});
}
本文标签: javascriptupdating xeditable input field based on returned valueStack Overflow
版权声明:本文标题:javascript - updating x-editable input field based on returned value - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741687104a2392503.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论