How does Jquery work?

How does Jquery work?

As part of Javascript, non-Ajax jquery code doesn't write into database (like persist), then how does all the function gets stored? in the browser? I am asking this because I am having problem with the form on my website. I am using the same source form html code for both the page that user can view the form and the page that user can edit the form (I used edit model to edit the form), thus the html and jquery code for the form of both view and edit are the same. However, jquery code for persisting checkbox, selection and hiding works only for edit page not on view page. That is why i want to know how exactly jquery really works in order to solve this problem. thanks.