Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6684437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:56:23+00:00 2026-05-26T04:56:23+00:00

Ok, So I am creating a cookie using jquery and storing a div in

  • 0

Ok,
So I am creating a cookie using jquery and storing a div in it.
This div has a lot of formatting,other divs,text ,etc in it.

var rentContainer = document.createElement('div');
rentContainer.setAttribute("class","module");
var carContainer = document.createElement('div');
carContainer.setAttribute("class","carRentContainer");
rentContainer.appendChild(carContainer);
.... and a lot of other things go in this rentContainer div

Now save it in cookie

$.cookie('rented_car', rentContainer);

everythings looks ok upto now.

when the page is refreshed and the body is loaded, it is now time to get this div and show it on page ( with same formatting,structure, etc).

so in my function I have

var rented_car_cookie = $.cookie("rented_car");
if(rented_car_cookie){
    document.getElementById('rentit').appendChild(rented_car_cookie);
    //rentit is already defined and exists on the page. All I need is to add the cookie div content on it.

but this gives me an error message

Firebug’s log limit has been reached. 0 entries not shown. Preferences
uncaught exception: [Exception… “Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]” nsresult: “0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)” location: “JS frame :: iGo.js :: checkCookies :: line 10” data: no]

Please help. What is the best way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:56:24+00:00Added an answer on May 26, 2026 at 4:56 am

    Anyway, storing full html element in cookie it bad thing. Maybe it’s better use JSON.

    Anyway you can try to save div as html string in the cookie.

    // set
    $.cookie("rented_car", $(rentContainer).html())
    
    // get
    var content = $.cookie("rented_car");
    var $rentContainer = $('<div class="module">' + content + '</div>');
    

    Code: http://jsfiddle.net/yecf8/

    But you need to know that there are a lot of different limitations for different browsers regarding cookies. For example:

    Microsoft Internet Explorer complies with the following RFC 2109 recommended minimum limitations:

    • at least 300 cookies
    • at least 4096 bytes per cookie (as measured by the size of the characters that comprise the cookie non-terminal in the syntax description of the Set-Cookie header)
    • at least 20 cookies per unique host or domain name
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating cookie using jquery, please see below code: var divID = $(link).next(.open-block-holder).find(div:first).attr(id);
I am creating an array to store in cookie using jquery.cookies.js Below is the
im practicing on creating a html using jquery cookies. i already know how to
I am creating a cookie and storing the value of username after succesfull login.
hey people i'm using a jquery plugin for creating cookies which seems to be
I am creating the cookie using the code below, How to read the txtusername
I am creating a login and the storing the user details in a cookie
I'm creating a website and I'm using facebook as my authentication. I did this
I'm trying to get a certain cookie in a java client by creating a
We're creating a new consumer/public-facing ASP.Net web app. There are two concerns: --Use cookie

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.