jQuery select where attribute = value

后端 未结 2 1215
挽巷
挽巷 2021-01-13 08:23

I am trying to select an input where the value equals a dynamic value

trimmed = jQuery.trim(a);
preSelectedCheckBox = $(this).find(\"input[value=\" + trimmed         


        
2条回答
  •  执念已碎
    2021-01-13 08:43

    Are you just missing the enclosing single quotes?

    trimmed = jQuery.trim(a);
    preSelectedCheckBox = $(this).find("input[value='" + trimmed + "']");
    

提交回复
热议问题