html5 - Problems removing registry localStorage -
i'm trying delete record localstorage , not work.
i have html button id localstorage have remove:
<input type='button' onclick='eliminardato(this.id)' id=' "+ dato_clave + "' value='eliminar' />
then, have function id(clicked_id) correctly received.
function eliminardato(clicked_id) { if(confirm('¿desea eliminar el favorito seleccionado?')) { localstorage.removeitem(clicked_id); } }
but record not deleted!. doing wrong?. if replace localstorage.removeitem(clicked_id); localstorage.removeitem('m1'); removed. may quotes? :s
thanks, daniela.
found it. don't blame being confused this!
id=' "+ dato_clave + "'
your problem space on line. remove space directly after single-quote, , id "m1" instead of " m1" (what trying remove). feel there should sort of action can take prevent issues later on, maybe you'll figure out yourself.
Comments
Post a Comment