Onclick not working on list in iphone using html

别说谁变了你拦得住时间么 提交于 2019-12-11 19:59:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!