Can someone explain what is wrong with the embedded code. It shows a warning about freezing, but does not execute the click event, as I expect, and the click does not work with either the tag <a>or the tag <select>. My goal is to expand the item selecton hover by triggering a click event
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
</head>
<body>
<a id="linkElement" href="www.google.co.uk">click</a>
<select name="cars" id="selectElemet">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<script>
$(document).ready(function () {
$("#selectElement").mouseover(function () {
$("#selectElement").trigger("click");
});
$("#linkElement").mouseover(function () {
alert('here');
$("#linkElement").trigger("click");
});
});
</script>
</body>
</html>
source
share