Onclick not working on list in iphone using html

2019-09-07 13:40发布

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条回答
Emotional °昔
2楼-- · 2019-09-07 13:48

The iPhone browser does not use onclick events, it uses ontouch. Look in to that event instead.

查看更多
登录 后发表回答