submit broken for form created with append()
I can't imagine what I'm doing wrong here. I'm just trying to create a simple form using JQuery's append(). The HTML version of the form looks like this:
-
<div id="content">
<form action='http://www.cnn.com/'>
<input type='submit' value='next'>
</form>
</div>
The form works fine. When I click 'next' I'm taken to cnn.com. But when I use this code to create the form:
-
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$("#content").append("<form action='http://www.cnn.com/'>");
$("#content").append("<input type='submit' value='next'>");
$("#content").append("</form>");
});
//]]>
</script>
</head>
<body>
<div id="content">
</div>
</body>
</html>
the form is displayed but clicking "next" does nothing and throws no JS errors. What am I doing wrong?