Click here to Skip to main content
14,298,693 members
Rate this:
Please Sign up or sign in to vote.
See more:
what happens if valid id name does not provide in selector using jquery and when we get an undefined and null error in jquery?


What I have tried:

I did not get any valid answer!
I which scenario using jquery we get undefined and null error?
Posted
Updated 10-Sep-19 4:44am
Comments
MadMyche 10-Sep-19 10:34am
   
You may want to provide the code in question (both the JS/JQuery AND the HTML) and work on explaining your question better.
verma.vivek 10-Sep-19 10:38am
   
I want in details theory that when we have to get an undefined and null error.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

If the selector you pass to jQuery doesn't match any elements, you will get an empty jQuery object back. You will not get any "undefined" or "null" errors by calling jQuery methods on that empty jQuery object.

Demo[^]
   

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100