How can I add a dynamic created element with jquery in current element.
<div>
<script>
LoadWidget("Hello");
</script>
</div>
.
.
.
.
<script>
function LoadWidget(name){
//For example:
var widget = $("<p />").html(name);
document.write(widget.?????????);
}
</script>
If you actually want to get the html of an element, you can do
or, more jQuery-esque:
However, it is probably better for you to use the jQuery
appendfunction to add your element to the page, by doing something like