单击jQuery jeditable触发器 [英] jQuery jeditable trigger on click
本文介绍了单击jQuery jeditable触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在我的应用程序中使用内联编辑。为此,我使用jQuery的Jeditable插件。
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);
});
如何添加此功能?
推荐答案
有很多方法可以做到这一切,这完全取决于您的HTML,但是例如,如果您有以下HTML:
There 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>
然后你可以使用以下JavaScript:
Then you can use following JavaScript:
/* Bind Jeditable instances to "edit" event. */
$(".edit").editable("http://www.example.com/save.php", {
event : "edit"
});
/* Find and trigger "edit" event on correct Jeditable instance. */
$(".edit_trigger").bind("click", function() {
$(this).prev().trigger("edit");
});
这篇关于单击jQuery jeditable触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文