SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Wizard Dean C's Avatar
    Join Date
    Mar 2003
    Location
    England, UK
    Posts
    2,906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Save posted state using jQuery

    I have a small dilemna. I am trying to save the state of my page by getting some HTML off it, base 64 encoding it and sending it in a hidden field when I submit the form (using jquery). This works, but it doesn't save values that I enter in form fields, or save selected states on dropdowns. Is there any way around this?

    Solved:

    Code:
    		$(this).find("input").each(function () {
    			this.setAttribute("value", this.value);
    		});
    		
    		$(this).find("option:selected").each(function () {
    			this.setAttribute("selected", "selected");
    		});
    Last edited by Dean C; Nov 7, 2007 at 05:56.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •