I have jQuery that makes div with internal elements on button click. I want that div to be saved in a table and show it to anybody that goes to that page.
I read this question Saving appended elements to database. Now I have two questions:
- In that answer, it only shows for one element (
<li>). How would I save other elements that are appended inside of mydiv? Answered in edit below and in question's answer - How would I load add those saved
divs on page load? I thought to make PHP code that searches all rows with those elements from column andechothem on page load
Div that I want to save:
var div = document.createElement("DIV");
var p = document.createElement("P");
var line = document.createElement("HR");
var text = document.createElement("P");
div.className = 'container';
p.className = 'date';
p.id = 'demo';
line.className = 'line1';
text.id = "text";
text.className = "feedback-container-text";
document.body.appendChild(div);
div.appendChild(p);
div.appendChild(line);
div.appendChild(text);
document.getElementById("text").innerHTML = "some text";
var d = new Date();
d.getDay();
document.getElementById("demo").innerHTML = d;
.container {
border-radius: 5px;
background-color: white;
padding: 20px;
width: 300px;
height: 220px;
float: left;
margin-left: 60px;
position: relative;
margin-bottom: 50px;
align-items: center;
justify-content: center;
box-shadow: 0 10px 12px 0 rgba(0, 0, 0, 0.13), 0 14px 30px 0 rgba(0, 0, 0, 0.09);
}
.container:hover {
width: 300px;
height: 225px;
margin-top: -5px;
transition-duration: 0.2s;
}