2016-09-26 95 views

回答

-1

是的,如果你使用jQuery,您可以创建使用的表单输入CSS选择像下面

var __inputListener__ = $("input[name=firstName]).click(function (e) {checkString(e.target.value);}); 

function checkString(string) { 
    //Run string validation here 
    if (true) 
    return true; 
    else 
    return false; 
} 

注意事件侦听器,我不知道这是e.target.value将返回值,你可能需要console.log(e)才能获得e的数组,并查看它的位置。你只要重复这一过程,你要多少投入检查等

编辑: 忘了提,你的意思是SET事件侦听器你想它来听元素已创建。

+0

马特,我的道歉,但这个问题是关于终极版形式... –

0

试试下面的代码:

componentDidMount() { 
    this.props.touch('username', 'email', 'age') // pass names of input fields 
} 
相关问题