I have this code that sets attribute "onclick" to all submit buttons to call a certain function. The userscript is going to run on social network sites(Facebook) and encrypt the messages the users send. So I want on the click event to pause the default action, access the message that it sends somehow (I guess with formData ), run encrypt function on the text message and continue the submit action with the message sent encrypted. So here is the script:
$( textarea , window.content.document)
.closest( form )
.find( input[type=submit] )
.attr("onclick","dont();");
function dont(){
//access formData sent with the submit action and encrypt the message
};