问题
I am creating a list dynamically.I want to call a function on onclick event of the list.In the list I am having a tag tag a
tag.The onclick is working on android and blackberry but not on the iphone.This is the sample code
htmlOutput +='<a style="display: block;" onclick="getAreaCodeClicked('+area+');">
<li style="overflow: hidden;>
<img src="Star.png" style="margin:0px;float:left;" />
<p style="white-space:nowrap;">
<label style="font-size:11px;color:black;">'+officeName+'</label><br>
<label style="font-size:8px;color:#A1A1A1;">'+officeLocation+'</label>
</p>
</li></a>
can anyone please tell me what is going wrong.
回答1:
The iPhone browser does not use onclick
events, it uses ontouch
. Look in to that event instead.
来源:https://stackoverflow.com/questions/11450696/onclick-not-working-on-list-in-iphone-using-html