Click here to Skip to main content
15,918,125 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i use emoji-picker while i have 2 functionality block user and unblock user

while user is block that time user can not click emoji icon so i add

$(".emojiPickerIconWrap .black").css("pointer-events", "none");

but in chrome page refress give error in console Cannot read property 'length' of undefined.

it's not giving me issue in functionality but i want to remove this error from chrome
. in Firefox work perfectly.

What I have tried:

Uncaught TypeError: Cannot read property 'length' of undefined
at Function.each (http://localhost:52903/Scripts/js/jquery.min.js:4:5193)
at getPickerHTML (http://localhost:52903/Scripts/js/jquery.emojipicker.js:451:7)
at EmojiPicker.createPicker (http://localhost:52903/Scripts/js/jquery.emojipicker.js:115:25)
at EmojiPicker.init (http://localhost:52903/Scripts/js/jquery.emojipicker.js:81:12)
at new EmojiPicker (http://localhost:52903/Scripts/js/jquery.emojipicker.js:69:12)
at HTMLTextAreaElement.<anonymous> (http://localhost:52903/Scripts/js/jquery.emojipicker.js:434:35)
at Function.each (http://localhost:52903/Scripts/js/jquery.min.js:4:5347)
at init.each (http://localhost:52903/Scripts/js/jquery.min.js:4:1999)
at init.$.fn.(anonymous function) [as emojiPicker] (http://localhost:52903/Scripts/js/jquery.emojipicker.js:431:10)
at disableemoji (http://localhost:52903/direct/Jayanti:1989:27)
Posted
Updated 6-Oct-17 1:02am

1 solution

Something that is 'undefined' has no properties (if you don't count being undefined).

This is like a null pointer, if that concept helps.

What it is saying is that you have tried to use something that doesn't exist. In your context, this could mean that connection to the emogi failed but you are still trying to work with it.

Use Your Debugger . . . put a break point where you ask for the length and see what's going on.
 
Share this answer
 
Comments
Jaydeep Shah 6-Oct-17 7:10am    
$(".emojiPickerIconWrap .black").css("pointer-events", "none"); if i remove this line from my code then this error not raise.

but i try $('.element').emojiPicker('destroy');
to make not clikable emoji for block user but still in this line have same issue.
W Balboos, GHB 6-Oct-17 7:17am    
You really should learn to use the debugger. Especially if it works and then quits.

The questions you need answers for are
(1) information is there when it works?
(2) what information is there when it fails?

For example, does the path to your emoji's get lost or modified? This would mean the emoji could not be found and the connection to it would be an undefined object with no properties.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900