Thursday, 19 July 2018

JQUERY : editable HTML 5 save at local storage

//editable cookies enable
    $(function(){
      var edit = document.getElementById('your-id');
      $(edit).blur(function(){
        localStorage.setItem('todoData', this.innerHTML);
      });
      //when the page loads
      if ( localStorage.getItem('todoData')){
        edit.innerHTML = localStorage.getItem('todoData');
      }
    })

<p id="your-id" contenteditable="true"> Ubah ayat ni dan ia save kat browser </p>

CONS 
satu id boleh simpan 1 satu data.. maksudnya, kalau id ada ditempat lain.. data pada id yang pertama sahaja akan boleh diubah

https://code.tutsplus.com/tutorials/28-html5-features-tips-and-techniques-you-must-know--net-13520

email mailto: pretext

 <a href="mailto:designoutsourced.com+info@gmail.com?subject=Maklumat%20lanjut%20pakej&body=Hai,%20saya%20berminat%20tahu%20lebi...