So i have a input page where the user can add or remove select menus, depending on how many items they need to choose. When the user proceeds past the page, but for some reason needs to return to it, they would usually use the back button in the browser. However, when that happens, None of the extra select menus (which I create using the Jquery .clone method) are present, only the original elements. Is there any way I can cache these cloned elements, so that they are present if the user needs to go back and change something on the previous page?
Here is the JS I am using to clone the elements
function addSelect(tagName, divId){
var cloner = $("select[tag=" + tagName + " ]:first").clone();
//$(cloner).attr("id", "diffId");
//$(cloner).attr("name", "diffName");
$("#" + divId).append('</p>');
$("#" + divId).append(cloner);
}
At first, the I thought the problem was that the cloned elements had the same id as the originals, so I tested that theory, as you can see from the commented out lines, but it made no difference.