I am trying to replace having to create a sub list and instead I want to add the div’s via javascript / jquery.
Here is what I have:
<script>
function makepage() {
var myvariable1="myTitle";
var newPage = $("<div>'+myvariable1+'</div");
//appendTo here?
</script>
...
Then the list:
<ul>
<li>
<a href="#" id="myid" onclick="makepage();">Click Here</a>
</li>
</ul>
The reason code creating it dynamically is that I want to pass some variables to it internally and I don’t want to use a form / post etc…
How can I make newPage appear when I click myid link?
Simply make sure you use the quotes you started with and append to body or what element do you want: