Reputation: 14280
I will make a new row on my draw-area what's a section. I append it to the draw-area but I will receive the new tree-row in the variable row. How can I do this? In other words I'll append a new div and store that in a variable. Now I store .draw-area
in the variable.
var row = $(".draw-area").append('<div class="tree-row"></div>');
Upvotes: 0
Views: 50
Reputation: 144
Let's see if I've understood well, you mean this?
$(".draw-area").append('<div class="tree-row"></div>');
And after insert, store it on a variable:
var row = $(".draw-area").last();
Upvotes: 0
Reputation: 14280
I've found it:
var row = $(".draw-area").append('<div class="tree-row"></div>').find('div');
Upvotes: 0
Reputation: 2118
I think you can do like this:
var row = $("<div class='tree-row'></div>");
$(".draw-area").append(row);
Upvotes: 2