Reputation: 481
I am using this snippet:
onmouseover="this.title=this.options[this.selectedIndex].title"
so that I can add title tags in dropdown menu text.
<form name="searchform" onmouseover="this.title=this.options[this.selectedIndex].title" onsubmit="return doSearch();" accept-charset="', $context['character_set'], '">
<input class="search_input" type="text" name="search" value="" />
<input class="search_button" type="submit" name="submit" value="" />
<select class="search_select" name="sengines" onchange="return saveOption();">
<option value="?action=search2;search=" title="Full forum search">Forum</option>
The error I get when I check with browser tools is
Uncaught TypeError: Cannot read property 'undefined' of undefined at HTMLFormElement.onmouseover
Upvotes: 0
Views: 356
Reputation: 1382
you need bind the function of the event listener in this case
<form name="searchform" onmouseover="function(this)" onsubmit="return doSearch();" accept-charset="', $context['character_set'], '">
the this means the current tag/element will passed by parameter of the event
onmouseover="function(this)"
well you add the event in the element that you want, or acces to child like you do
this.options[this.selectedIndex].title
Upvotes: 0