SO - 21571919
by Arun P Johny
HTML
<div id="newForm"></div>
JavaScript
(function ($) {
$.fn.create = function () {
var form = '<div id="form" class="container">';
form += '<div>User Login</div>';
form += '<form action="/create" method="post">';
form += '<input type="text" name="name" placeholder="name">';
form += '<input type="password" name="password" placeholder="Password">';
form += '<button type="submit">Log into your account</button>';
form += '</form>';
form += '</div>';
return this.append(form);
};
}(jQuery));
$(document).ready(function () {
$("#newForm").create();
});