I have added a mouseover event on the button. In that event, I am calling the mouseover event on the anchor. However, that anchor mouseover is not properly triggered. I am not able to see the URL preview at the bottom left corner, like I could see if I hover the over the anchor element. How could I properly trigger mouseover on an anchor?
$(document).ready(function() { $("button.pdfbutton").mouseover(function(e) { $("#anchorelem").show(); $("#anchorelem").mouseover(); }); }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> <button class="pdfbutton">PDF</button> <a href="https://google.com" id="anchorelem" style="display: none;">Some text</a>
aelement you won't see the browsers URL preview appear. If you want that behaviour you'll need to restructure your HTML to rely on actual user-generated events instead of programmatically created ones.