jquery - Saving variable of a row in localstorage onclick -
i have textfields nested , have class called "names"
. close each textfield link "view details" class called "view details"
.
i want achieve onclick
of particular view details on row, want save value in textfield in localstorage
$(document).ready(function() { $('.view details').on('click', function(event) { localstorage.setitem('name', $('.names').val()); }); });
here's link fiddle: http://jsfiddle.net/z4dl6jdr/
your selector not select view detail remove space. $('.view details') change $('.view.details')
$('.view.details').on('click', function (event) { var inputelemnet = $(this).closest('tr').find('.names'); localstorage.setitem(inputelemnet.attr('name'), inputelemnet.val()); // console.log(localstorage.getitem(inputelemnet.attr('name'))); });
Comments
Post a Comment