$(function(){
//choose one below at once, the results are different
$('#click').click(clickMe.popup);
$('#click').click(clickMe.popup());
});
var clickMe = {
message: 'hello',
popup: function(){
alert(this.message);
}
}
<input type='button' value='click me' id='click' />
the results are different,
when I choose the first one, I get a popup when clicking the button, but it shows "undefined".
when I choose the second one, I automatically get a popup when loading in, and there is the "hello" message.
Question :
- what's the different between popup() and popup ?
- what's wrong with the message inside the popup ?