I want to get span value my code is below. All i want is get span value with class=”hideme” when i click any of image. Im using html5 jquerymobile phonegap_v2.0 framework Xcode_v4.3
css code:
.hideme{
diplay:none;
}
html code:
<ol id='ulist' data-role='listview' data-filter='true'>
<li>
<a href='#' rel="external" data-mini="true">John<span id='id1' class="hideme" >1</span></a>
<div data-role="field" style="float: right;margin-top: -30px;padding-right: 4%;">
<img data-mini="true" src="icons/ios/info.png" alt="info"/>
<img data-mini="true" src="icons/ios/session.png" alt="session"/>
<img data-mini="true" src="icons/ios/prospclient.png" alt="Prospect Client"/>
<img data-mini="true" src="icons/ios/delete.png" alt="delete"/>
</div>
</li>
<li>
<a href='#' rel="external" data-mini="true">Carmen<span id='id2' class="hideme" >2</span></a>
<div data-role="field" style="float: right;margin-top: -30px;padding-right: 4%;">
<img data-mini="true" src="icons/ios/info.png" alt="info"/>
<img data-mini="true" src="icons/ios/session.png" alt="session"/>
<img data-mini="true" src="icons/ios/prospclient.png" alt="Prospect Client"/>
<img data-mini="true" src="icons/ios/delete.png" alt="delete"/>
</div>
</li>
<li>
<a href='#' rel="external" data-mini="true">Julia<span id='id3' class="hideme" >3</span></a>
<div data-role="field" style="float: right;margin-top: -30px;padding-right: 4%;">
<img data-mini="true" src="icons/ios/info.png" alt="info"/>
<img data-mini="true" src="icons/ios/session.png" alt="session"/>
<img data-mini="true" src="icons/ios/prospclient.png" alt="Prospect Client"/>
<img data-mini="true" src="icons/ios/delete.png" alt="delete"/>
</div>
</li>
</ol>
how to do in javascript or jquery
Span elements don’t have a “value”. If you’re asking how to get the text content of the span contained within the same
<li>element as a clicked<img>element then you can do this with jQuery:If you’re asking how to get the
idattribute, use.attr("id")instead of.text().