ReferenceError:没有定义className
ReferenceError: className is not defined
在我的rails应用程序,是使用reactjs我有coffescript代码,看起来像这样:
DOM = React.DOM
CreateNewMeetupForm = React.createClass
getInitialState: ->
{
title: ''
description: ''
}
titleChanged: (event) ->
@setState(title: event.target.value)
descriptionChanged: (event) ->
@setState(description: event.target.value)
render : ->
DOM.form
className: 'form-horizontal'
DOM.fieldset null,
DOM.legend null, "New Meetup"
DOM.div
className: 'form-group'
DOM.label
htmlFor: 'title'
className: 'col-lg-2 control-label'
'Title'
DOM.div
className: 'col-lg-10'
DOM.input
className 'form-control'
placeholder: 'Meetup title'
id: 'title'
type: 'text'
value: @state.title
onChange: @titleChanged
DOM.div
className: 'form-group'
DOM.label
htmlFor: "title"
className 'col-lg-2 control-label'
'Description'
DOM.div
className "col-lg-10"
DOM.input
className 'form-control'
placeholder: 'Meetup description'
id: 'description'
type: 'text'
value: @state.description
onChanage: @descriptionChanged
CreateNewMeetupForm = React.createFactory(CreateNewMeetupForm)
$ ->
React.render(
CreateNewMeetupForm(),
document.body
)
返回如下错误:
ReferenceError: className is not defined
我怎样才能解决这个问题?
在最后一个代码块中的三个实例中,您使用不带冒号的标签className
:
className 'col-lg-2 control-label'
className "col-lg-10"
className 'form-control'
其余代码使用className:
相关文章:
- 用嵌套函数和默认函数定义函数
- Dojo不解析自定义小部件的模板html中的小部件声明性
- 为什么“;未定义的“;在JavaScript中结束循环
- 要求未定义JS回调参数
- 控制台返回var不是't定义,但它是
- 在自定义mean.io包中使用angular-chart.js作为依赖项
- 如何检查管道中未定义的项目
- TypeError:无法读取属性'推'未定义的JavaScript
- jQuery自定义验证比较多个输入的序列
- 查看JS对象的所有键,甚至是getter定义的键
- fetch() 函数未在 Ubuntu Chromium 浏览器上定义
- $window.ga在AngularJS事件中未定义
- 如何在JQuery函数中定义一个值,然后调用另一个函数并使用该值
- 是否有任何方法可以使用jQuery替换在数组中定义值的文本
- 未捕获的TypeError无法读取未定义的属性socialsharing
- toggleClass之后,ClassName变为未定义
- 类型错误:document.getElementsByTagName(..).className未定义
- JavaScript运行时错误:无法获取property 'className'未定义或空引用的
- ReferenceError:没有定义className
- Element.className返回未定义