[英]How can I Append the Id attribute Selector or Store the Id in Jquery variable and use that variable as selector?
[英]How can I use the attribute selector with a variable?
我需要使用此表单,因为它可以处理元素ID中的空格。
$("div[id='content Module']").whatever();
但是我需要将“内容模块”替换为变量吗?
我试过了
$("div[id=" + my_var + "']").whatever();
但这没有用
您缺少“
$("div[id=" + my_var + "']").whatever();
应该
$("div[id='" + my_var + "']").whatever();
试试这个$("div[id='" + my_var + "']").whatever();
你忘记了开放的使徒
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.