jjzjj

something_undefined

全部标签

javascript - a.nodeName is undefined Jquery错误

a.nodeNameisundefined我查过这个,但对我来说解释似乎一点都不清楚。functiondeleteThisRow(){$(this).closest('tr').fadeOut(400,function(){$(this).remove();});}blahblahblah 最佳答案 您函数中的this关键字未引用被单击的元素。默认情况下,它会引用DOM中的最高元素,即window。要解决此问题,您可以使用不显眼的事件处理程序,而不是过时的on*事件属性,因为它们在引发事件的元素的范围内运行。试试这个:$("trtd

javascript - 在javascript中为 undefined variable 设置默认值

理想情况下,我希望能够编写如下内容:functiona(b){b.defaultVal(1);returnb;}这样做的目的是,如果b是任何定义的值,b将保持该值;但如果b未定义,则b将设置为defaultVal()的参数中指定的值,在本例中为1。这可能吗?我一直在玩弄这样的东西:String.prototype.defaultVal=function(valOnUndefined){if(typeofthis==='undefined'){returnvalOnUndefined;}else{returnthis;}};但是我没有成功地将这种逻辑应用于任何变量,尤其是undefine

javascript - 为 Angular JS 启用 html 5 模式会抛出 JS 错误 : Failed to instantiate module due to: TypeError: Cannot read property 'html5Mode' of undefined

如何为AngularJS启用html5模式?'usestrict'varblogApp=angular.module('blogApp',['ngRoute']).config(['$routeProvider',function($routeProvider,$locationProvider){$routeProvider.when('/disclaimer',{templateUrl:'templates/disclaimer.html',controller:'DisclaimerCtrl'});$routeProvider.otherwise({redirectTo:'/'}

javascript - Google Map API V3- MarkerClusterer undefined

我按照库和youtube指南将标记聚类器添加到我的map,但我遇到了问题。MarkerClustererundefined我已按照指南中的说明定义了MarkerClusterer,但仍然出现上述错误。下面是我的代码MaPagedeGoogleMapsV3html,body,#map_canvas{margin:3;padding:3;height:100%;}.tooltip{background-color:#ffffff;font-weight:bold;border:2px#006699solid;width:150px}varscript='';document.write(s

javascript 初始化为 undefined 或 null 或 ""

在我开始学习时,Java脚本有很多错误的值。我有一个从服务获取值并加载到数组中的程序,如下所示:functionloadNames(){Global.names=//whatshouldIusehere?undefined,null,"",0,{}oranythingelsevarlnames=getLNames();//thisisdoingsomemagicif(lnames.length!==0){Global.names=newArray();for(vari=0;i我想知道重置Global.names的正确方法。这里最合适的是什么?在代码中我只想检查if(Global.nam

javascript - 谷歌地图 API v3 - TypeError : Result of expression 'google.maps.LatLng' [undefined] is not a constructor

我正在创建一个静态html页面来显示数据中的多个位置。我刚刚复制了其中一个示例并正在向后工作,但我在Safari检查器中收到以下错误:main.js:1SyntaxError:Parseerrorsample.htm:10TypeError:Resultofexpression'google.maps.LatLng'[undefined]isnotaconstructor.这是我的html代码:MultiMarkersSampleviaGoogleMapsfunctioninitialize(){varmyLatlng=newgoogle.maps.LatLng(-30.2965590

javascript - require.js 未捕获类型错误 : cannot read property '__module_path__; of undefined

所以我刚刚开始尝试掌握require.js,但它似乎不起作用。当我使用标签将其包含在我的html中时:在chrome中加载页面时出现以下错误UncaughtTypeError:Cannotreadproperty'__MODULE_PATH__'ofundefined->require.js:538在firefox中我得到一个稍微不同的错误:TypeError:parentisundefined->require.js:538不知道我怎么会导致这个问题,因为它是require.js的全新安装,我的main.js中还没有代码。提前致谢 最佳答案

javascript - 未捕获的类型错误 : Cannot read property 'focus' of undefined

此问题在我的页面加载时发生。使用以下脚本-jquery.simplemodal-1.4.3.js-jqueryv1.7.1下面是一个小代码快照,是发生此错误的simplemodal内的代码。focus:function(pos){vars=this,p=pos&&$.inArray(pos,['first','last'])!==-1?pos:'first';//focusondialogorthefirstvisible/enabledinputelementvarinput=$(':input:enabled:visible:'+p,s.d.wrap);setTimeout(fun

javascript - Apollo "Subscription field must return Async Iterable. Received: undefined"

我有一个触发channel事件“countIncr”的突变,但我没有看到事件的相应订阅与事件负载一起触发。更新:我已经对这篇文章进行了多次更新,现在我正在更改标题以更能代表我所在的位置。我收到graphqlPlayground错误"SubscriptionfieldmustreturnAsyncIterable.Received:undefined"我遇到问题的TGRstack复制:https://github.com/TGRstack/tgr-apollo-subscription-example-microservice/没有TGRstack的工作再现:https://github

javascript - react : 'this.state' is undefined inside a component function

我在组件内的函数中访问this.state时遇到问题。我已经找到了this关于SO的问题并将建议的代码添加到我的构造函数中:classGameextendsReact.Component{constructor(props){super(props);...this.state={uid:'',currentTable:'',currentRound:10,deck:sortedDeck};this.dealNewHand=this.dealNewHand.bind(this);this.getCardsForRound=this.getCardsForRound.bind(this)