Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren+ 2
How to disable anchor tag(<a>) with Javascript using Tag name attribute (so that link return nothing)
2 Antworten
+ 1
Following code may help you
JavaScript
if (condition) { document.getElementsByTagName('a')[0].removeAttribute('href'); }
and if you are using
jQuery
if (condition) { $('a').first().removeAttr('href'); }
0
Not possible