Home > object required > object required error javascript

Object Required Error Javascript

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to solve “object required” exception in javascript? up vote 0 down vote favorite I have written a simple Javascript function as follows: function loginValidate(){ var rValue = true; var username = document.getElementById("username").value; var password = document.getElementById("password").value; if(username=="" || password==""){ alert('Empty field'); rValue = false; } return rValue; //alert('hi'); } When I hit the submit button I am getting the error as: Object required : loginValidate.js line 3 character 3 I am getting the error on both IE 8 and FF 10 but it works fine in Eclipse internal browser. Am I missing something? Kindly help, thanks in advance. javascript share|improve this question edited Feb 13 '12 at 5:41 nnnnnn 94.6k1191151 asked Feb 13 '12 at 5:30 omkar sohani 372515 document.getElementById got nothing, so cannot have .value –Eric Yin Feb 13 '12 at 5:31 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote I'm guessing that when that function runs, document.getElementById("username").value; is not finding an element. As a result document.getElementById("username") returns null and null.value throws an exception, since null is not allowed to have properties. Exactly why that is not finding your element depends on your HTML and when this JS snippets runs. share|improve this answer answered Feb 13 '12 at 5:37 Alex Wayne 86.3k272

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions http://stackoverflow.com/questions/9255997/how-to-solve-object-required-exception-in-javascript Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Object required error Java Script up vote http://stackoverflow.com/questions/23977196/object-required-error-java-script -1 down vote favorite i have problem with below code which i use for Jira. When i run the code, i get Object required error at line 4 Could you please Help! the values for approver and assigne are right so there is no problem with them

 

© Copyright 2019|winbytes.org.