Append Section in Javascript
by Santosh Thakur
HTML
<p><button type="button" id="test">Test</button></p>
<div id="log"></div>
JavaScript
var me = {
type: "dog",
test: function( one, two, event ) {
$( "#log" )
.append( "<h3>Hello " + one.type + ":</h3>" )
.append( "I am a " + this.type + ", " )
.append( "and they are " + two.type + ".<br>" )
.append( "Thanks for " + event.type + "ing." )
.append( "the " + event.target.type + "." );
}
};
var you = { type: "cat" };
var they = { type: "fish" };
var proxy = $.proxy( me.test, me, you, they );
$( "#test" ).on( "click", proxy );