Scenario
In a GUI, a user inserts some text in a text input and then clicks a button: inserted text will be displayed in a div.
I have found a trivial solution (demo here), that is setting the output text inside the handler accessing the input element object. It sucks.
Rather, I would pass the input text (not the element) to the handler.
Question
How can I pass parameters (the input message text in this case) to the handler function?
I modified the code in your jsFiddle. In jQuery, you can pass data as an argument and access it using
event.datajQuery reference.