Jquery OR || operator not working

前端 未结 3 853
余生分开走
余生分开走 2021-01-29 11:54

it\'s a really simple question. The or operator is not working, i am trying to display a different function for both the title and amount field name. Thank you

$         


        
3条回答
  •  再見小時候
    2021-01-29 12:11

    You either have to restate the condition like

    if (field.name === "title" || field.name === "amount")
    

    or you can use an array

    if (["title","amount"].indexOf(field.name) > -1)
    

提交回复
热议问题