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 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']);
精彩评论