I have a website which loads from an ajax code and I have an language select image link which I want to add an onclick event to. The onclick event has to be added to the <a>
tag. When the page loads in the browser, it forms the html code as
<a class="whatever">
<div id="1234" class="whatever1" width: 25px; height: 25px;">
<img class="whatever2" alt="" src="imagelink.png" width: 25px; height: 25px;">
</div>
</a>
Since I cannot change the html code manually (I could add javascript into the page), how could I load this:
onClick="SetCookie('Language','En');document.location.href='http://example.com/';"
into the <a>
tag
?
Could I use the class in the <a>
tag to target the element and load the onclick event into it somehow?
Thanks in advance for any help.