You need to compare the raw DOM elements, e.g.:
if ($(this).parent().get(0) === $('body').get(0))
or
if ($(this).parent()[0] === $('body')[0])
More Related Contents:
- How to compare two date values with jQuery [duplicate]
- How can I use JQuery to post JSON data?
- Is it possible to use jQuery .on and hover?
- How to send a PUT/DELETE request in jQuery?
- Send JSON data via POST (ajax) and receive json response from Controller (MVC)
- How can I post an array of string to ASP.NET MVC Controller without a form?
- How to enable or disable an anchor using jQuery?
- jQuery Date Picker – disable past dates
- How to trigger click event on href element
- Using jQuery to build table rows from AJAX response(json)
- Detecting no results on jQuery UI autocomplete
- How do you add pseudo classes to elements using jQuery?
- What is the purpose of the ‘node_modules’ folder?
- How can I count the number of children?
- jQuery.ajax fails when url is from different server
- jQuery Set Mouse Position (not cursor position)
- Jquery resizing image
- jquery datetime picker set minDate dynamic
- Calling function after .load (Jquery)
- Set the selected index of a Dropdown using jQuery
- jQuery: selector (classname with space)
- Getting fullscreen mode to my browser using jquery
- Click event called twice on touchend in iPad
- jQuery: append() object, remove() it with delay()
- bind event only once
- How to add jQueryUI library in MVC 5 project?
- jQuery resize not working at FireFox, Chrome and Safari
- Jquery post and unobtrusive ajax validation not working mvc 4
- How do I select an element with special characters in the ID?
- Why return this.each(function()) in jQuery plugins?