This is a follow up to this question comments.
Index counter is not needed here nor should inline javascript be used with jQuery Mobile. It is just a bad practice because it can severely miss behave in certain situations.
Solution
Lets say this is yours generated listview, I gave it an id called test-listview (it will be used in javascript):
HTML:
<ul data-role="listview" data-inset="true" id="test-listview">
<li><a href="#">
<p><strong id="selectedMed">Element 1</strong></p>
</a>
</li>
<li><a href="#">
<p><strong id="selectedMed">Element 2</strong></p>
</a>
</li>
<li><a href="#">
<p><strong id="selectedMed">Element 3</strong></p>
</a>
</li>
</ul>
If you want to find out a text of selected listview element you would do it like this:
Javascript
$(document).on('pagebeforeshow', '#index', function(){
$(document).on('click', '#test-listview li', function(){
alert($(this).find('#selectedMed').text());
});
});
Working example
And here's a working jsFiddle example: http://jsfiddle.net/xNJ7A/