带有标签的jQuery标签选择器不起作用 [英] Jquery Label selector with variable appended not working

查看:216
本文介绍了带有标签的jQuery标签选择器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

附加了变量的标签选择器

label selector with variable appended

 var altRoute= getAlternateRoute(route);
  $("label[for='b-'+altRoute+'-0-option']").addClass("muted");

此代码段不起作用?这是怎么了?

This code snippet is not working? what am doing wrong here?

推荐答案

引号放置错误.像这样使用

You have misplaced quotes. Use like this,

var altRoute = getAlternateRoute(route);
$("label[for='b-" + altRoute + "-0-option']").addClass("muted");

这篇关于带有标签的jQuery标签选择器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆