Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery JEditable - How to Add A Visible Edit Me Button?

i love this plugin but the reality is that most people won't realize at first that they can click on the text to edit.

Ideally, it would be nice to add a Button next to the text or a simple [Edit] link that the user clearly sees but never gets submitted via ajax.

Any ideas?

like image 495
Sam3k Avatar asked Jan 05 '10 21:01

Sam3k


1 Answers

Just add a event to the button which clicks on the jEditable field:

<span class="jeditable">jEditable field</span>
<input type="button" class="jeditable-activate" value="Edit me!" />

And in jQuery:

$('.jeditable-activate').click(function() {
    $(this).prev().click();
});

That should do it. After all, that's the same thing as the user clicking on the element.

like image 85
Tatu Ulmanen Avatar answered Sep 20 '22 07:09

Tatu Ulmanen