JQuery JEditable - How to Disable on click editing

前端 未结 2 958
没有蜡笔的小新
没有蜡笔的小新 2020-12-30 11:40

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 ab

相关标签:
2条回答
  • 2020-12-30 12:24

    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>
    
    0 讨论(0)
  • 2020-12-30 12:27

    There's an undocumented option event that you can use when you create your jEditable fields.

    (It's not actually undocumented but it's just mentioned off-hand in one sentence on the jEditable docs page.)

    You can use it to change the event that makes the field editable. You can use any jquery event, even custom events.

    For example, on my project I created an edit.mode event that makes the field editable which I can then trigger however I like, with a button, a hotkey, whatever.

    0 讨论(0)
提交回复
热议问题