user959128
user959128

Reputation: 957

get text from textbox and textarea and save in cookie value using jquery or javascript

I have one textbox and one textarea. I want to save the text whatever I entered in that textbox but that textbox is in Iframe.

How I do it using jquery or javascript?

Please help me.

Upvotes: 0

Views: 2020

Answers (2)

Joe
Joe

Reputation: 82594

window.localStorage is another option working on IE8+, modern browsers without the 4K ceiling:

localStorage['textareaKey'] = $('#textarea').val();

$('#textarea').val(localStorage['textareakey']);

Upvotes: 1

Samich
Samich

Reputation: 30105

Use jQuery.cookie plugin to work with cookies.

$("#myframe").contents().find('#textboxid').blur(function() {
   $.cookie('textboxvalue', $(this).val()); // for storing
});

Where myframe id of the frame and textboxid id of the textbox inside of iframe.

Upvotes: 2

Related Questions