I
I
iDrugov2017-03-11 12:04:52
JavaScript
iDrugov, 2017-03-11 12:04:52

How to add href attribute for iOS?

I write the following code in jquery: which works everywhere except for iPhones. I searched for this topic on the Internet, the problem is not only mine ( 1 , 2 , 3 ). The most interesting thing is that somewhere on jfiddle my code works on an iPhone, but it was me (in an iframe application) and only iPhones that made a goat's face. From useful advice on the Internet, the recommendation to write data instead of attr or declare a reference in a variable and substitute it in the code did not bring success.
$('a[name=myName]').attr('href', '//myLink);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-03-11
@iDrugov

The point is that in html5 <a></a>it cannot have a name attribute. Therefore, iphone and other devices may not be able to find it. This is even correct behavior.
Here:
https://www.w3schools.com/TAGs/tag_a.asp
It is advised to use id instead of name for links

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question