This might be basic, but this issue takes me hours to figure out and I haven’t found any solutions for this. I am using WordPress 3.5 and I have an external javascript file called general.js in this folder: wp-content/themes/[folder_name]/js. In general.js, I write a function called hideError, basically to hide error label that popped out from my textboxes.
(function($) {
function hideErrorLabel(i) {
//codes for handling label
}
})(jQuery);
I called it like this:
<span class="component-wrapper" onmouseover="hideErrorLabel(0)">
<input type="text" name="txtName" size="10" />
<label for="txtName" class="error">All field must be filled.</label>
</span>
I pass a parameter because these textboxes are array.
Strangely, it gives me javascript error “hideErrorLabel is not defined”. What went wrong? Please help.
Just remove the first and last line of that javascript code. You are hiding your function! Declare it openly in any script tag.