[英]How to convert submitted form data into a json array and store the json array into localstorage using JQUERY
如何提交的表單數據轉換成JSON
陣列和存儲JSON
數組localstorage
使用jQuery
和Javascript
? 以及如何在HTML
頁面上打印輸出數據?
<form> <label>Name</label> <input id = "name" type = "text"/> <label>Title</label> <input id = "title" type = "text"/> <label>Description</label> <input id = "description" type = "text" rows="4" cols="50"/> <label>New Comments</label> <input id = "comments" type = "text" rows="4" cols="50"/> <input type="radio" name = "icon"/> like <input type="radio" name = "icon" /> unlike <button id = "save" value = "submit">Save</button> <button id = "display" value = "submit">Display</button> </form>
$( "form" ).submit(function( event ) {
console.log( $( this ).serializeArray() );
event.preventDefault();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.