Uncaught Typeerror: Object is not a Function. Clone html and Back button

Asked

Viewed 133 times

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?

  • 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 examplefunction back()
 {
 n--;
 $(''#grid'').html(divClone[n]);
 }

  • 2

    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.

  • 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.

  • 4

    The excerpt $(''#grid'') is identical to your project? If yes, there are quotation marks. The correct one would be $('#grid').

  • I believe that the friend @guilhermenagatomo found the problem.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.