我需要动态添加列表视图.我可以动态构建列表视图,但我正在追加
The HTML code snippet.
<ul id="mymenu" data-role="listview" >
</ul>
Jquery Code Snippet.
$("#accpmenu").append('<li><a href='+ "#" + ' id="a"  "> <img src="letterheader.png" >'+ this.textContent + '  </a> </li>'); 
Run Code Online (Sandbox Code Playgroud)
我甚至想动态构建然后追加
谢谢Shyam
有一个列表视图,这是在加载页面时动态加载的.这会在列表视图中添加元素.问题是我放置了后退按钮.在转到上一个屏幕并返回当前屏幕后,它正在加载数据并附加到列表视图.
I need to remove the <li> elements from the list view.
The HTML code snippet.
<ul id="mymenu" data-role="listview" >
</ul>
Jquery Code Snippet.
$("#mypmenu").append('<li><a href='+ "#" + ' id="a"  "> <img src="letterheader.png" >'+ this.textContent + '  </a> </li>'); 
Now i need to remove the elements from the list view (mymenu)which are loaded already.
Run Code Online (Sandbox Code Playgroud) 我创建了一个listview带有链接的动态id="a".
<ul id="accpmenu" data-role="listview" >
</ul>
$("#accpmenu").append('<li><a href='+ "#" + ' id="a" ">'+ this.textContent +'</a>  </li>');
Run Code Online (Sandbox Code Playgroud)
现在我想确定我从中点击的元素的索引listview.
$("#a").live("click",function(e)
{
    //What should i write here to get the selected index?.
}
Run Code Online (Sandbox Code Playgroud)
我想要基于此的索引号我需要加载动态XML.
请帮我解决这个问题.
谢谢Shyam