I working with an existing website, with some anchors tags like so:
<ul>
<li><a id="answer-1" href="/" rel="0">Answer 1</a></li>
<li><a id="answer-2" href="/" rel="1">Answer 2</a></li>
<li><a id="answer-3" href="/" rel="2">Answer 3</a></li>
<li><a id="answer-4" href="/" rel="3">Answer 4</a></li>
</ul>
I need to programmatically click one of these anchors depending on the user's selection.
On the desktop, in IE, this works:
document.getElementById('answer-1').click();
However, doesn't quite work in iOS safari, this results in a popup:
if (!document.getElementById('answer-1').click) alert ('Oh no!');
Best I can tell, they have some other javascript hooked up using to send the rel
tag as an answer. Is there another way to programmatically click the anchor in iOS Safari? Or do I need to go digging in their javascript to find out what is being called when the anchor is clicked?
I have also tried this, which doesn't work:
window.location.href = document.getElementById('answer-1').href;
They must be doing more in Javascript somewhere (maybe jquery).