I want to bind a function to all the textarea and want to run it whenever a key gets pressed.
function fx(docid)
{
$('#'+docid).val=encodeURIComponent($('#'+docid).val());
//document.getElementByID('docid').value = encodeURIComponent(document.getElementByID('docid').value);
}
Note: the page will have different textarea, I want a single function to do the same job for all the textarea. I don't want to hard code the event with the textarea <textarea onkeydown="..." />
Edit
I want to trigger the function on multiple events, thats on keypress, keydown,click