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 8974859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:45:22+00:00 2026-06-15T18:45:22+00:00

I have a select tag in my HTML and in Internet Explorer, when it

  • 0

I have a select tag in my HTML and in Internet Explorer, when it is called from a JavaScript function an error occurs.

This is the html creates the select box-

 <select id="item1" name="Item 1" onchange ="fn();">  
    <option value="0">Please select gender</option>    
    <option value="1">Male</option> 
    <option value="2">Female</option>  
 </select>    

function for onchange event of select-

function fn()
{   
    var s = document.getElementById('item1');  
    if(s!= null)  
    {  
       alert('not null')  //if object not == null  
    }  
}   

This is the error I am getting in IE –

Message: Object expected  
  • 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-15T18:45:23+00:00Added an answer on June 15, 2026 at 6:45 pm

    Why do you get the domNode, if it already fires the function? Wouldn’t the onChange could not get fired at all, if the domNode would be null (didn’t exist)?

    How about this:

    HTML

        <select id="item1" name="item1" onchange ="fn(e);">  
           <option value="0">Please select gender</option>    
           <option value="1">Male</option> 
           <option value="2">Female</option>  
        </select> 
    

    JS

        function fn(event) {
           // FF, Safari etc..
           if(event.target) {  
               alert('fn() fired by ' + event.target.id)
           }
           // IE
           else if(event.srcElement) {
               alert('fn() fired by ' + event.srcElement.id)
           }
        }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have a html select tag like this: <select name = options> <option
I have a select html tag, and I want the background-color of the option
I have the following SQL: SELECT * FROM [Database].dbo.[TagsPerItem] INNER JOIN [Database].dbo.[Tag] ON [Tag].Id
I am running into a stranger error in Internet Explorer. I have a form_for
I have a plugin that changes the look of select html tag on all
I have a html select tag after user select value I want to send
I have simple select tag, in which I would like to see numbers from
I have 3 drop down boxes, created using the HTML select tag. On page
I need parse a select value in html file. I have this html file:
I have a simple drop-down menu using HTML's select tag. The code for the

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.