I am using jQuery mobile and I have a similar <li> class in different pages. Like this:
<div data-role="page" id="engineering">
<h1 style="color:black;"> Departments </h1>
<ul data-role="listview" data-theme="a" data-split-theme="b" data-split-icon="plus" data-inset="true">
<li class="departments"><a href="#department">Department of Electrical and Electronics</a></li>
<li class="departments"><a href="#department">Department of Computer Science</a></li>
</ul>
</div>
<div data-role="page" id="medicine">
<h1 style="color:black;"> Departments </h1>
<ul data-role="listview" data-theme="a" data-split-theme="b" data-split-icon="plus" data-inset="true">
<li class="departments"><a href="#department">Department of Medical Sciences</a></li>
</ul>
</div>
Using $('departments').text(), this returns all of the text of the class departments. How can i get text of the specific list element that i click?