What is the process for creating an element with a specific class name using JavaScript?
I attempted to create an element like the following:
<div class ="dialog_red_top_page">
<div class ="inner_dialog_red_top_page">
<p class="dialog_red_top_page_text">
test
</p>
</div>
</div>
However, my JavaScript code did not work. How can I accomplish this task successfully?
http://jsfiddle.net/n5phf/186/
<script type="text/javascript">
$(window).load(function(){
$('#myBtn').click(function(){
var div = $('<div class ='dialog_red_top_page'><div class ='inner_dialog_red_top_page'><p class='dialog_red_top_page_text'>test</p></div></div>');
div.html("test");
div.appendTo('#wrapper');
});
});
</script>