本文介绍了从动态生成的列表中获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个jquery移动应用程序,我想在选中时从动态生成的列表视图中的隐藏输入字段中获取值,然后将值传递给另一个页面。我该怎么办?如何确定单击哪个列表视图项? < ul data-role = listview class = ui-listbox data-theme = c 角色 = listbox 样式 = margin-removed20px > < li data-role = list-divider 角色 = 标题 tabindex = 0 class = ui-li ui- li-divider ui-btn ui-bar-b ui-btn-up-undefined > 今天的旅程< / li > <? php foreach ($ journeys as $旅程):?> <? php if ($ journey [' user_type'] == 0):?> //动态生成的列表 < li class = list-item-speaker data-图标 = false > < a href = #traveldetails?id =<?php echo $ journey ['journey_id']; ?> id = journeyDetailsDriver data-transition = flip > < div class = list-item-removed-speaker style = float:left > < img src = <?php echo $ journey ['facebook_image']; ?> class = thumb-speaker-small alt = <?php echo $ journey ['facebook_first_name']。 。$ journey ['facebook_last_name']; ? > /> < h3 style = padding-removed10px; > <? php echo $ j ourney [' from_destination']。 - 。$ journey [' to_destination']; ?> < / h3 > < p style = padding-removed10px > <? php echo $ journey [' facebook_first_name']。 。$ journey [' facebook_last_name']; ?> < / p > < p style = padding-removed10px; padding-removed10px; font-size:0.9em; font-weight:bold > <? php echo $ journey [' depart_date']; ?> < / p > //我需要隐藏的字段 < 输入 type = hidden name = journeyID id = journeyID value = <?php echo $ journey ['journey_id'];?> > < / div > < h3 style = 浮动:右;保证金removed45px;颜色:#189ACB > <? php echo $ journey [' seat_available']。' seat'; ?> < / h3 > < / a > < / li > < / ul > 解决方案 journeys as 旅程):?> <? php if ( journey [' user_type' ] == 0):?> //动态生成的列表 < li class = list-item-speaker data-icon = false > < a href = #journeydetails?id =<?php echo I have a jquery mobile app and I want to get an value from a hidden input field within a dynamically generated listview when selected and then pass the value to another page. How would I do that? How do I determine which listview item was clicked?<ul data-role="listview" class="ui-listbox" data-theme="c" role="listbox" style="margin-removed20px"> <li data-role="list-divider" role="heading" tabindex="0" class="ui-li ui-li-divider ui-btn ui-bar-b ui-btn-up-undefined">Today's Journey</li> <?php foreach ($journeys as $journey) : ?> <?php if ($journey['user_type'] == 0): ?> //dynamically generated list <li class="list-item-speaker" data-icon="false"> <a href="#journeydetails?id=<?php echo $journey['journey_id']; ?>" id="journeyDetailsDriver" data-transition="flip" > <div class="list-item-removed-speaker" style="float:left"> <img src="<?php echo $journey['facebook_image']; ?>" class="thumb-speaker-small" alt="<?php echo $journey['facebook_first_name']." ".$journey['facebook_last_name']; ?>" /> <h3 style="padding-removed10px;"><?php echo $journey['from_destination']." - ".$journey['to_destination']; ?></h3> <p style="padding-removed10px"><?php echo $journey['facebook_first_name']." ".$journey['facebook_last_name']; ?></p> <p style="padding-removed10px; padding-removed10px; font-size:0.9em; font-weight:bold"><?php echo $journey['depart_date']; ?></p> //VALUE I NEED FROM HIDDEN FIELD <input type="hidden" name="journeyID" id="journeyID" value="<?php echo $journey['journey_id']; ?>"> </div> <h3 style="float:right; margin-removed45px; color:#189ACB"><?php echo $journey['seats_available']. ' seats'; ?></h3> </a> </li></ul> 解决方案 journeys asjourney) : ?> <?php if (journey['user_type'] == 0): ?> //dynamically generated list <li class="list-item-speaker" data-icon="false"> <a href="#journeydetails?id=<?php echo 这篇关于从动态生成的列表中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-21 16:07