Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

CmdReturnSubmit for Saving Comments

This discussion is related to the CmdReturnSubmit addon.

I've been banging away at this a bit and could use some help, or some fresh eyes.

I want to add the functionality to the CmdReturnSubmit plugin to let a user press Cmd/Ctrl and Return to submit an edited comment, as if they had clicked the 'Save Comment' button.

How do I specify which textarea (id='Form_Body' in both cases) to attach the event to so that I can add something like the following code to class.cmdreturnsubmit.plugin.php?

$('#Form_Body').keydown(function(event){
    if((event.ctrlKey||event.metaKey) && ((event.keyCode == 0xA)||(event.keyCode == 0xD)))
        $('#Form_SaveComment').click(); 
    });
R_J

Comments

Sign In or Register to comment.