Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Mohamed_Ali_B_
Beginner
44 Views

IOS Device link and onclick event not working correctly

When I put a link in an event that I have to change the link . it works properly in emulator ios device but nothing works. 

Example :

<a href="#page2"    id="myLink"   style="cursor: pointer;"    onclick="save();">                       click me                    </a>

<script>

function save()

{

if(condition)

{  document.getElementById('myLink').href='#page3';  }

else{document.getElementById('myLink').href='#page4';}

}

</script>

 

Tags (2)
0 Kudos
3 Replies
Amrita_C_Intel
Employee
44 Views

Hello,

Can you provide some screenshots? And if possible can you send me .zip file of your project so that I can provide you more detailed help.

Amrita_C_Intel
Employee
44 Views

You should think of the Emulate tab as a Cordova API simulator, not as a device emulator. It provides you with a convenient viewport to help you visualize the approximate layout of your app on various devices and itsimulates the core Cordova APIs to make it easier to debug apps that use those APIs. It does not simulate real devices nor does it simulate third-party Cordova plugin APIs. Getting your app to work in the Emulate tab is not a guarantee that it will work on a real device. Conversely, if things work on a real device but do not work in the Emulate tab, that is not an indication that your app is "broken." The only way to know with certainty that your app works as intended is to build it and install it on real devices.

Elroy_A_Intel
Employee
44 Views

I recommend reviewing the following example using the onclick attribute.

Example

<!DOCTYPE html>
<html>
<body>

<a id="demo" onclick="myFunction(this, 'red')">Click me to change my text color.</a>

<script>
function myFunction(elmnt,clr) {
    elmnt.style.color = clr;
}
</script>

</body>
</html>

http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onclick_color2

Reply