JQuery: creating multiple objects

I am creating a sticky reminder app for the iphone website. The goal is for the user to create as much โ€œstickyโ€ as he wants - all data will be saved using localstorage.

I have a working sticker prototype here: JSFIDDLE

Now all I have to do is figure out how to allow the user to create as many stickers as they want, each with its own local storage area. Is this possible with jquery or would it be easier to use php to accomplish this?

Thanks in advanced

+4
source share
1 answer

I did this in Flash once. What do you mean by local storage? You can let the user do as much as he wants: http://jsfiddle.net/NegYd/14/ using javascript / jquery. Key:

function appendSticky(){ var e= document.getElementById("submittext").value; $("#stickies").append("<li>"+e+"</li>"); $.post("store.php", { text: e} );//you'll have to submit user information } 

and html:

 <input id="submittext" type='text'/> <input type='submit' value='add note' onClick="javascript:appendSticky();"/> 

Inside store.php you save the sheets in a MySQL database. $sql="INSERT.."

I suggest organizing sheets with float:left; with a random margin-left value, not a list for final perception. Or even better, make it post-drag-and-dropable.

+1
source

Source: https://habr.com/ru/post/1337333/


All Articles