jQuery created a div. How to change proprety of this div?
Hi All,
I'm trying to make a multi window system. It's like each link the user click the jQuery create a div automatically and set id. As below:
$(".link").click(function() {
var value = $(this).attr("href");
var value_without = value.slice(1);
if ($(value).length){ // check if the div exist
alert("nao");
} else {
$("#content").append( '<div id='+value_without+' class=panel><input type=button class=minimiza value="_"><button class=fecha>X</button>'+value_without+'</div>' );
$(value).draggable({ containment: "parent" });
$(value).resizable({ containment: "#content"
});
}
});
It works well. But after that I want to change some prop of this div created. Like this:
** I put inside the div the follow button <input type="button" class=fecha panel-data=".panel1" value="X">
$(".fecha").click(function() {
var panelData = $(this).attr("panel-data");
$(panelData).hide();
});
$(".minimiza").click(function() {
var panelData = $(this).attr("panel-data");
$(panelData).css("top", "0");
$(panelData).css("height", "25px");
});
But at this point the code doesn't work. It's like the div appear only while the page running. If I try to see the source code the divs that were automatically created did not appear.
Any help?