javascript - Store table data using localstorage and passing it to a form -
right trying use html5's localstorage api grab value table, , pass value form.
for example, when user clicks on "sign today" on form: http://yft.ac/upcoming-workshops/, want information given row (date, time, location), heading above (ex: yft admissions insights) stored, , displayed in field "workshop interested in" on page: http://yft.ac/contact-us/.
i'm not best javascript here have far:
contact us:
$('input#workshop').text( localstorage.getitem('workshop') );
upcoming workshops page:
$('body').on('click', 'a.button', function(){ var index = $(this).parents('table').index('table'); var cur_workshop = $(this).parents('.innercontent').find('h3').eq(index).text(); localstorage.setitem('workshop', cur_workshop); });
i tried piece above code isn't working, hope jump start might more well-versed in javascript.
you have few problems in page.
- modernizer library not included - using
modernizr.localstorage
in code - the
localstorage.setitem('workshop', cur_workshop);
code added before jquery library added page - since code used jquery move after inclusion of jquery - look somewhere you/wordpress calling jquery.noconflict() -
$
not refer jquery anymore usejquery
instead of$
in code
Comments
Post a Comment