[英]jquery editInPlace anchor text editing
我有一個鏈接和一個按鈕並排放置。 當用戶單擊按鈕時,鏈接的文本應該可以編輯。
我使用jquery editInPlace來使鏈接的文本可編輯。 鏈接的文本變得可編輯,但我無法在文本編輯后恢復鏈接屬性。 這是我的html和javasrcript文件
demo.js
1 $(document).ready(function(){
2 $("img.modifyButton").click(function(){
3 $(this).prev().editInPlace({
4 success: function(){
5 $(this).unbind('.editInPlace');
6 $(this).unbind('click');
7 },
8 url:'Admin/p.inline_coupon_edit_frontend.php',
9 text_size:55,
10 show_buttons: false,
11 params:"field=Title"
12 });
13
14 $(this).prev().on('click', function(event)
15 {
16 event.preventDefault();
17 });
18 $(this).prev().click();
19 });
20
21 });
html文件
16 <div class="crux">
17 <a href="www.google.com">title</a>
18 <img class="modifyButton" src="./editInPlace_files/modifyButton.png" alt="None" width="13" height="13">
19 </div>
git repo代碼:git clone https://github.com/VihaanVerma89/dummy.git
不確定你的問題是什么。 你的php文件是空的,但是當使用回調而不是你的PHP文件時,一切似乎都正常 - 鏈接目標是完整的。
你的版本出了什么問題? 你是從PHP文件返回值嗎? 如果不是這樣,我相信會失敗
這似乎工作得很好,除非我錯過了你想要做的事情:
$(document).ready(function(){
$("img.modifyButton").click(function(){
$(this).prev().editInPlace({
success: function(){
$(this).unbind('.editInPlace');
$(this).unbind('click');
// alert('success');
},
error: function(){
$(this).unbind('.editInPlace');
$(this).unbind('click');
//alert('error');
},
callback: function(b,abc){
return abc;
},
text_size:55,
show_buttons: false
,params:"field=Title"
});
$(this).prev().on('click', function(event)
{
event.preventDefault();
});
$(this).prev().click();
});
});
我認為問題出在你的PHP腳本 - 上面的工作作為你的例子,不包括php - 因為它沒有包含在你的git repo中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.