开发者

jQuery access element by id

开发者 https://www.devze.com 2023-01-05 02:48 出处:网络
This may be a si开发者_运维技巧mple question. I need to access an html element using jQuery in the following way:

This may be a si开发者_运维技巧mple question. I need to access an html element using jQuery in the following way:

var element_ID = "my" + "name" +"xyz";

Now I want to access/manipulate the element whose ID I have stored in 'element_ID' as above.

This doesn't work : $('#element_ID')

Please let me know the correct way to access the element stored 'element_ID' variable.

-Vijay


Just use string concatenation once more...

$('#' + element_ID)
0

精彩评论

暂无评论...
验证码 换一张
取 消