2016-09-26 104 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 
} 
相關問題