开发者

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

开发者 https://www.devze.com 2023-04-08 13:26 出处:网络
I have one textbox and one textarea. I want to save the text whatever I entered in that textbox but that textbox is in I开发者_如何学运维frame.

I have one textbox and one textarea. I want to save the text whatever I entered in that textbox but that textbox is in I开发者_如何学运维frame.

How I do it using jquery or javascript?

Please help me.


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.


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

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

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

精彩评论

暂无评论...
验证码 换一张
取 消