How do I select a newly added element in jquery?
4 answers
Two things:
1) Don't use periods in your IDs
2) you could do it somehow better:
var dialogDiv =$('<div id="popup-dialog"></div>').appendTo('body');
At this point, you can chain more or just use a variable dialogDiv
.
This stops you from hitting your performance by selecting an item that you already have access to.
+2
source to share