I am trying to insert a breakline (<br />) after every textbox on click of a button using the below code :
HTML:
<input type="text" id="text1" /><b>This is test</b>
<br />
<button>New line</button>
Jquery:
$(document).ready(function(){
$("button").click(function(){
$("#text1").append("<br />");
});
});
I am getting the following error in the console
Message: Object doesn’t support this property or method
Please let me know how I can achieve this.
use after() instead of append.
http://api.jquery.com/after/
http://jsfiddle.net/66ERc/