Indexof Error
Contents |
Uncaught TypeError: Cannot call method 'indexOf' of null why is this, please... ('loc' var is fine, obviously, since no error occurs in any other browsers..) thank you... Jeff_Mott 2013-05-15 17:52:23 UTC #2 maya90 said: 'loc' var is a.indexof is not a function jquery fine, obviously, since no error occurs in any other browsers.. Well... according to Chrome, a.indexof is not a function jquery 3 it's not fine. In Chrome, the variable loc is null. The one line your posted doesn't give us any clue why that uncaught typeerror: a.indexof is not a function jquery might be. You'll have to show us where loc gets its value. maya90 2013-05-15 19:36:33 UTC #3 here's where this line occurs: http://mayacove.com/misc/js_ajax_mail-mob.js error is thrown by this line: if (loc.indexOf('localhost') != -1) { the url.indexof is not a function jquery var is declared in another .js file to which this one has access, namely...http://mayacove.com/misc/js_val-mob.js they're both included in standard conventional form in header of html,js_val-mob.js is called first.. and why would this var not work only in Chrome??? this doesn't make sense.... thank you.... felgall 2013-05-15 19:39:29 UTC #4 Have you checked using the debugger to confirm that loc is being assigned a value in each browser? maya90 2013-05-15 19:43:20 UTC #5
Indexof Is Not A Function Javascript
I'm testing with console.log() right now... it prints fine in Chrome, prints what var evaluates to (current url) but that line ( if (loc.indexOf('localhost') != -1) { ) just throws an error in Chrome.. man, this is bizarre (doesn't even happen in Safari...) thank you... maya90 2013-05-15 20:08:00 UTC #6 after running numerous tests, have determined that Chrome simply won't play ball with that var inside this fn: subBtn.click(function(e) { ..... } even if I decl a new var inside that function Chrome throws the exact same error... I think it has a prob with indexOf() method, but only inside the function.. if (testVar.indexOf('localhost') != -1) { console.log('bbb') } prints fine outside the function.. inside the function it throws that error.... this is weird... maya90 2013-05-15 20:13:08 UTC #7 inside the function: if I do [INDENT] console.log(testVar) [/INDENT] prints fine... but if I do [INDENT] if (testVar.indexOf('myString') != -1) { console.log('bbb') } [/INDENT] get error on indexOf() Jeff_Mott 2013-05-15 20:14:13 UTC #8 If you post a link to the page that shows this error, we may be able to tell you why. maya90 2013-05-15 20:54:37 UTC #9 ok, here's recreation.. http://mayacove.com/resume-rd/test_chrome.jsp error occurs when you click on "send" js is here.. http://mayacove.com/resume-rd/js/js_ajax_mail-mob.js thank you... Jeff_Mot
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
Uncaught Typeerror: Url.indexof Is Not A Function
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions javascript indexof function not working Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million jquery 3 indexof programmers, just like you, helping each other. Join them; it only takes a minute: Sign up indexOf Error When Triggering Event up vote 0 down vote favorite In JavaScript, I have the following event I am trying https://www.sitepoint.com/community/t/indexof-method-throwing-error-in-chrome-only/30581 to trigger using jquery's trigger() function: document.addEventListener('keydown', function(e) { ( // e.which == 34 || PAGE DOWN // e.which == 32 || SPACE axis == 'X' && e.which == 39 // RIGHT // axis == 'Y' && e.which == 40 // BOTTOM ) && deck.next(); ( // e.which == 33 || PAGE UP axis == 'X' && e.which == 37 // LEFT // axis == 'Y' && e.which == 38 // TOP ) http://stackoverflow.com/questions/34563740/indexof-error-when-triggering-event && deck.prev(); }); I am trying to trigger this event listener using the following line: $(document).trigger({eventType:"keydown", which:39}); However when I do this, I get the following error: Uncaught TypeError: q.indexOf is not a function I would hope instead that the line triggers deck.next(); Please advise as to what I am doing wrong. javascript jquery share|improve this question edited Jan 2 at 7:39 asked Jan 2 at 7:37 Summer Developer 369113 Please add the portion of code where you use indexOf –che-azeh Jan 2 at 7:41 @Bek var e = jQuery.Event("keydown"); e.which = 39; // # Some key code value $(document).trigger(e); does not work for me, as that answer indicates. –Summer Developer Jan 2 at 7:42 @che-azeh I don't ever use that, that is just the error message jquery gives me, which is why I don't understand it. The error message is invoked after $(document).trigger({eventType:"keydown", which:39}); –Summer Developer Jan 2 at 7:43 add a comment| 3 Answers 3 active oldest votes up vote 2 down vote accepted add jquery event listener and then in invoke it (you need jquery event listener because you are triggering it with jquery) $(document).on('keydown', function(e) { ( // e.which == 34 || PAGE DOWN // e.which == 32 || SPACE axis == 'X' && e.which == 39 // RIGHT
View Site Leaders Advanced Search Forum Pentaho Users Pentaho Data Integration [Kettle] JavaScript http://forums.pentaho.com/showthread.php?59278-JavaScript-indexOf-error - indexOf error If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results is not 1 to 6 of 6 Thread: JavaScript - indexOf error Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 01-21-2008,09:30 AM #1 paveluk View Profile View Forum Posts Private Message Member Join Date Oct 2007 Posts 31 is not a JavaScript - indexOf error Hi, Ive got problem with running simple javascript in my transformation. Following JS should find char in string of column Titul and erase all char since this char. The javascript is correct, but during running transformation it stoppes with following error: Very strange think is that this error shows up on various data so the data are right, and script as well for sure... Can someone help pls? Error: HTML Code: 2008/01/21 15:22:53 - Remove part beginning with '0'.0 - ERROR (version 3.0.1, build 534 from 2007/12/12 12:28:23) : Javascript error: 2008/01/21 15:22:53 - Remove part beginning with '0'.0 - ERROR (version 3.0.1, build 534 from 2007/12/12 12:28:23) : TypeError: Cannot call method "indexOf" of null (script#3) 2008/01/21 15:22:53 - Remove part beginning with '0'.0 - ERROR (version 3.0.1, build 534 from 2007/12/12 12:28:23) : 2008/01/21 15:22:53 - Remove part beginning with '0'.0 - ERROR (version 3.0.1, build 534 from 2007/12/12 12:28:23) : at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValues