Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery JEditable - How to Disable on click editing

I was wondering if you can stop text being editable on click? I have a separate edit button to make the text editable and that's the only way that I want the user to be able to edit the text, so want to turn off the on click editing?

Any ideas?

like image 270
user406307 Avatar asked Jul 30 '10 00:07

user406307


1 Answers

Britt is right, add a custom event, and trigger it with a button for example. Here is some code to explain it:

The custom event:

$('#id').editable('http://www.example.com/save.php', {
    event : 'custom_event'
});

And the trigger:

<button onclick="$('#id').trigger('custom_event');">click to trigger</button>
like image 179
Lutsen Avatar answered Nov 09 '22 07:11

Lutsen