Pass data from a dynamically generated list from one page to another

前端 未结 1 819
不知归路
不知归路 2021-01-22 12:38

Within my jquery mobile app, I have a dynamically generated listview and what I want to do is when the user clicks a list item, I want to get a value from a hidden field within

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-22 13:28

    You could use URL query tags, or save the data in a cookie or in HTML5 local/session storage.

    To get information from a list, here is an example

    • Coffee
    • Tea
    • Milk
    var a = [], list = document.getElementsByTagName("li"); Array.prototype.forEach.call(list, function(entry) { a.push(entry.textContent); }); console.log(a);

    Available on jsfiddle

    0 讨论(0)
提交回复
热议问题