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

前端 未结 1 817
不知归路
不知归路 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

    <ul>
      <li>Coffee</li>
      <li>Tea</li>
      <li>Milk</li>
    </ul>
    
    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)
提交回复
热议问题