在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Python  HTML/ jquery選擇器出錯

jquery選擇器出錯

   var spvalue=$(this).text();
  $("[data-input="+spvalue+"]").prop("checked",true);

spvalue取值可能是 AP 4200或者6*180

jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: [data-input=AP 5200 ]

Uncaught Error: Syntax error, unrecognized expression: [data-input=5*112 ]
應該如何處理

回答
編輯回答
憶當年

引號問題

// $("[data-input=AP 5200]").prop("checked",true); →
$('[data-input="AP 5200"]').prop("checked",true);

// $("[data-input="+spvalue+"]").prop("checked",true); →
$('[data-input="'+spvalue+'"]').prop("checked",true);
2017年1月22日 05:17
編輯回答
艷骨

是不可以包含*號吧

2018年4月25日 14:33