I have this code:
jQuery('.hoverbgpfthnailiface').click(function(e){
var target = e.target;
while (target.nodeType != 1) target = target.parentNode;
if(target.tagName != 'TEXTAREA'){
jQuery('.header-search-form').css({ 'display' : 'none' });
}
});
The strange this is that if I put it on Chrome Console it’s working but when I add it on my files is not working and is not displaying any errors in Console.
Any idea why is this happening ?
Have you tried putting the code in a ready function?
Tell me if that worked for you 🙂
EDIT
Just one thing, in case you are interested, in a jQuery event when the binded function is called,
thisis the same ase.targetEDIT2
You’re executing your code before the elements with the class of hoverbgpfthnailiface exists.
You are creating them in line 2716, and because the $(document).ready is below the one you used in the code of the question it’s executed later.
So I recommend you try moving the code from line 103 to 2717