jquery escape square brackets to select element

前端 未结 6 1427
余生分开走
余生分开走 2021-01-03 04:55

Consider a input element


Here the input field is dynamically generat

6条回答
  •  忘掉有多难
    2021-01-03 05:37

    You can use the _.escapeRegExp method from the Lodash library.

    console.log($('#' + _.escapeRegExp('meta[152][value]')).val());
    
    
    

提交回复
热议问题