4
I’m having a system problem where I need to make a button for come back and thought of a function to clone using and a function for the button come back.
But the problem is that when I log in to the system I go to a menu and when I click on an option it loads a sub-menu in it grid , is where all user interaction occurs, when I click on the back it performs the function back go back to the menu, but if I try to access another module the functions do not work and return this error:
Uncaught Typeerror: Object is not a Function.
Code:
var n= 0;
var divClone=[""] ;
function clone(){
divClone[n]=$("#grid").clone();
n++
}
function back(){
n--;
$(''#grid'').html(divClone[n]);
}
You are cloning
#grid
and returning the value to it?– Wallace Maxters
Yes, when he clones, he returns with the call of functions and values already defined. because the JS is set at the beginning of the HTML and does not change, so when I click on a button you have to execute this function for example
function back()
 {
 n--;
 $(''#grid'').html(divClone[n]);
 }
– Raphael de melo
Don’t you think it’s better to implement a browsing history instead of cloning the content over and over again? Even because doing a simple test here I realized that you will inflate the content of
divClone
, probably after some time this can become a problem.– Pedro Henrique
Inflating because? No, because I use PL/SQL to generate the system and for security no page and the same. So whoever "writes the code" is the database. And to decrease the number of pages generated I am modifying for the system to work only updated the Div’s.
– Raphael de melo
The excerpt
$(''#grid'')
is identical to your project? If yes, there are quotation marks. The correct one would be$('#grid')
.– Guilherme Nagatomo
I believe that the friend @guilhermenagatomo found the problem.
– PauloHDSousa