Object Required Error In Javascript Jquery
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 IE8 Jquery Javascript “Error: Object required” Bug up vote 0 down vote favorite IE8 throws an "Error: Object required" message (error in the actual jquery library script, not my javascript file) when the switch statement in this function runs. This code works in IE6, IE7, FF3, and Safari... Any ideas? Does it have something to do with the '$(this)' selector in the switch? Thanks! function totshirts(){ $('.shirt-totals input').val('0'); var cxs = 0; var cs = 0; var cm = 0; $.each($('select.size'), function() { switch($(this).val()){ case "cxs": cxs ++; $('input[name="cxs"]').val(cxs); break; case "cs": cs ++; $('input[name="cs"]').val(cs); break; case "cm": cm ++; $('input[name="cm"]').val(cm); break; } }); } javascript jquery internet-explorer-8 share|improve this question edited Apr 24 '09 at 18:48 asked Apr 24 '09 at 18:42 Chris Voth 5613718 No clues as to which line? IE 8 does have a built in script debugger. –Greg Apr 24 '09 at 18:49 The error is coming from the Jquery Library file, not my javascript file... Line 14 'value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value' –Chris Voth Apr 24 '09 at 18:52 Thanks for removing the extra cases as they weren't adding anything to the example, but I'd like to say it makes my point stronger as well: Use this more generic approach and you'll be able to change it easier in the future. –altCognito Apr 24 '09 at 18:52 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote Oh noes, don't do it that way at all. Do something more along the lines of this: $('.shirt-totals input').val('0'); $('select.size').each(function() { var name = $(this).attr('name'); var currVal = parseInt($("input[name='"+name+"']").val()); $("input[name='"+name
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 jquery/javascript object required error up vote 0 down vote favorite I am working in an ASP .net mvc project. The weird issue is I am running a JavaScript/jQuery which randomly gives object required error. Sometimes it occurs but sometime it does http://stackoverflow.com/questions/787074/ie8-jquery-javascript-error-object-required-bug not occur at all. What I am doing is making an explicit link click call to load a page as follows: function LoadPopup() { $("#page2link").click(); } I call Loadpopup() in $(document).ready() After the above gets executed, page2 loads and the JavaScript for page2 is trying to run but I don't know why suddenly page2's JavaScript throws error. I don't know exactly at what line it throws error. The break point comes at MicrosoftAjax.cs[Dynamicfile]. I am wondering why my debugger does not hit the breakpoint http://stackoverflow.com/questions/1958810/jquery-javascript-object-required-error that I placed in page2's JavaScript. The stackj trace however shows a list of "JavaScript anonymous functions" and also shows that these anonymous functions are called from loadpopup(). Some more information. I am having a master page. Loadpopup() runs when mystartup.aspx loads, which inherits from the master page. Can anyone please help me in this regard? Please let me know if you need more detail? jquery share|improve this question edited Dec 5 '13 at 23:58 Benjamin 11.4k1693172 asked Dec 24 '09 at 15:55 SARAVAN 11 I am the same user who posted the question. May be my ID is different now. To my surprise I dont get the javascript object required error whne I used firefox and even the firebug did not higlight anything and everything went fine. But I dont know why I am getting the error in IE alone. –SARAVAN Dec 24 '09 at 17:05 Well, IE is definitely a different beast than FF. There is a FirebugLite plugin (getfirebug.com/lite.html) that you can load with your pages and it will give you some of the capabilites of FB in FF. –Peter Rowell Dec 24 '09 at 17:09 Well If I am not able to get the error in Firefox, then I am not sure if firebug helps in my case. The problem just comes with IE alone. Is there anything that I can do to debug in IE? –SARAVAN Dec 24 '09 at 17:43 add a comment| 1 Answer 1 active oldest
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 http://stackoverflow.com/questions/3460334/ie-8-object-required-javascript-function 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 IE 8, object required javascript function up vote object required 0 down vote favorite I have been looking all the day about my strange problem. I have a page, which is loading dynamically content via ajax (with jQuery), but I think it's not a jQuery problem. The dynamic page contains a javascript function, let's call it "myTestFunction()", without any parameters. After document.ready (jQuery) or at the end of the page, I call this function. Firefox runs this function. object required error IE 8 said: object required. I think IE can not find the function. I am very confused about this IE message. My hope is somebody will have an idea about this. How can I tell IE where the function is? Kindest regards, many thanks for answers. !!!! This Code explains the Problem, running not tested but it should descript the Problem, i hope. Sorry for the strange "code formatting, this is my first example of code in this editor". //example of code, a code like this is loaded by our Framework with ajax in a div. //myclass generates the HTML-Output, and generates the Function //myTestFunction in an JavaScript Tag see below $myClass = new MyClass('127.0.0.1/application/file.php'); echo $myClass->renderHTMLcode(); ?> script // alert 1 for me for testing. alert('ende'); $(document).ready(function() { // alert 2, for me , ready event of jQuery has fired alert('ready'); // function with the problem myTestFunction(); } ); script ///... } } ?> javascript jquery ajax internet-explorer-8 share|improve this question edited Aug 12 '10 at 6:31 asked Aug 11 '10 at 15:59 Sinderella_42 62 5 Please post your code so we can see how you are defining an