admin管理员组文章数量:1327849
I need to use inline edit in my application. For this purpose I am using the Jeditable plugin for jQuery.
I want to trigger editable mode for an element only when I click on it. This is my code which doesn't work:
var tet = "";
$(".edit-client").click(function(event) {
tet = "#"+event.target.id;
//alert(tet);
});
$(tet).editable("/bestcredit/admin.php/request/editClient", {
submitdata : function (value,settings){
return {"Client[id]":'.$model->client->id.' };
},
//indicator : "Saving...",
//tooltip : "Click to edit...",
submit : "OK",
name : "Client["+tet.substr("1")+"]"
//alert(1);
});
How can I add this functionality?
I need to use inline edit in my application. For this purpose I am using the Jeditable plugin for jQuery.
I want to trigger editable mode for an element only when I click on it. This is my code which doesn't work:
var tet = "";
$(".edit-client").click(function(event) {
tet = "#"+event.target.id;
//alert(tet);
});
$(tet).editable("/bestcredit/admin.php/request/editClient", {
submitdata : function (value,settings){
return {"Client[id]":'.$model->client->id.' };
},
//indicator : "Saving...",
//tooltip : "Click to edit...",
submit : "OK",
name : "Client["+tet.substr("1")+"]"
//alert(1);
});
How can I add this functionality?
Share Improve this question edited Jun 6, 2019 at 6:58 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Aug 14, 2012 at 12:22 nyanevnyanev 11.5k7 gold badges50 silver badges77 bronze badges 1- Possible duplicate of Jeditable - Activate edit of X by clicking on Y – CodeBrauer Commented Oct 5, 2016 at 10:08
1 Answer
Reset to default 10There are many ways to do it and it all depends on your HTML, but for example if you have following HTML:
<div class="edit" id="unique_id">Editable text</div>
<a href="#" class="edit_trigger">Edit me!!</a>
Then you can use following JavaScript:
/* Bind Jeditable instances to "edit" event. */
$(".edit").editable("http://www.example./save.php", {
event : "edit"
});
/* Find and trigger "edit" event on correct Jeditable instance. */
$(".edit_trigger").bind("click", function() {
$(this).prev().trigger("edit");
});
本文标签: javascriptjQuery jeditable trigger on clickStack Overflow
版权声明:本文标题:javascript - jQuery jeditable trigger on click - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742218054a2434929.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论