JavaScript Javascript Compare Objects to Elements javascript compare objects in array,javascript compare objects for equality,

http://jsfiddle.net/PhilFromHeck/KzSxT/

In this fiddle, you can see at line 38 in the Javascript that I've attempted to make a comparison that isn't working. I believe it because one of the variables is an Object, where the other is an Element; does anyone have any advice as to how I can can find a match between these two?

menuID[0] = document.getElementById('menuOne'); 
menuID[1] = document.getElementById('menuTwo'); 
menuID[2] = document.getElementById('menuThree'); 
menuID[3] = document.getElementById('menuFour'); 
$('.menu').mouseenter(function () {
  for (var i = 0; i < 3; i++) {
    if(menuID[i] == $(this)){
      //this condition is not met, there's an alert which will add more detail in the fiddle
    }
  }
}
Answer:1

Method document.getElementById returns a DOM element an not a jQuery object. In the mouseenter event handler this refers to a DOM element as well.

So in order to compare them you shouldn't convert this to a jQuery object:

if (menuID[i] === this) { ... }
Answer:2

I need to use an Image instead of using dropbox default chooser button. I have gone through their API docs and I couldn't find any such ways to use other elements for dropbox chooser. Can anyone ...

I need to use an Image instead of using dropbox default chooser button. I have gone through their API docs and I couldn't find any such ways to use other elements for dropbox chooser. Can anyone ...

For my highchart, I want to set maximum value of 100 and minimum value of 1. When I try to code like this, it outputs is 0-100 not 1-100. If I change or remove max range, it works fine for small ...

For my highchart, I want to set maximum value of 100 and minimum value of 1. When I try to code like this, it outputs is 0-100 not 1-100. If I change or remove max range, it works fine for small ...

We have Node.js as a server which helps in getting us remote rest service, from client html I am trying to get response headers from the jQuery Ajax call using below code: $.ajax({ type: "get", ...

We have Node.js as a server which helps in getting us remote rest service, from client html I am trying to get response headers from the jQuery Ajax call using below code: $.ajax({ type: "get", ...

I have function for validation for check below scenarios, but function used map and filter methods. so its not working in IE8.How to rewrite this function without using map and filter. var case1 = "...

I have function for validation for check below scenarios, but function used map and filter methods. so its not working in IE8.How to rewrite this function without using map and filter. var case1 = "...

  1. custom javascript validation
  2. custom javascript validation mvc
  3. javascript custom validation message
  4. javascript custom validation function
  5. javascript custom validation error message
  6. custom validation javascript asp.net
  7. javascript custom validation rules
  8. custom validation javascript adobe
  9. custom javascript form validation
  10. nintex custom javascript validation
  11. javascript custom input validation
  12. html5 custom validation javascript
  13. custom email validation javascript
  14. create custom validation javascript
  15. custom date validation javascript
  16. nintex forms custom javascript validation
  17. contact form 7 custom javascript validation
  18. sharepoint custom validation javascript