Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:03:11+00:00 2026-06-09T16:03:11+00:00

if (((document.activeElement).parentNode).tagName == div) { //do amazing things } For some reason a specific

  • 0
if (((document.activeElement).parentNode).tagName == "div") { 
   //do amazing things 
}

For some reason a specific function of mine isn’t working, and I think it has to do with the line above. Is the line above syntactically correct, or is wrong? If the line above is correct, I’ll either delete the question (because then the question is useless) or add additional information of the rest of the function.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:03:12+00:00Added an answer on June 9, 2026 at 4:03 pm

    The tagName gives the tag in upper-case so it would give DIV

    See https://developer.mozilla.org/en-US/docs/DOM/element.tagName

    You can use .toLowerCase() == 'div'(as suggested in the comments) to eliminate the case issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my HTML and JS: function invokeFunc() { // ajax request alert(document.activeElement); //
activeElement property of the document object sets current element that has the keyboard focus.
document.getelementbyid('txtbox') is not working when I used in content page as it is working
document.getElementById('container').addEventListener('copy',beforecopy,false ); In Chrome / Safari, the above will run the "beforecopy" function when
document.observe('click', function(e, el) { if (e.target != Element.descendantOf('calendar')) { $('calendar').fade(); } }); I am
document.body.innerHTML works to search within the body. Is there a similar function for searching
document.onkeydown.toString() returns onkeydown function but I only want to get this function's name. Is
document.addEventListener(orientationChanged, updateOrientation); I am trying to call a function on updateOrientation , but the
document.addEventListener('contextmenu', function (e) { e.preventDefault() e.stopPropagation() e.returnValue = false e.cancleBubble = true }) No
$(document).ready(function(){ $(.thumbnail).hover( function(){ $(.overthumb).fadeTo(1000,1).show(); }, function(){ $(.overthumb).fadeTo(1000,0).hide(); } ); }); http://jsfiddle.net/AndyMP/qCa7a/2/ The code above

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.