开发者

Accessing <a> inside div id

开发者 https://www.devze.com 2023-02-15 17:50 出处:网络
im trying to color the 开发者_JAVA百科<a> background color <div id=\"contact\"><a href=\"mailto:name@.domain.net>name</a>

im trying to color the 开发者_JAVA百科<a> background color

<div id="contact"><a href="mailto:name@.domain.net>name</a>

with the selector

$('#contact a').css("background", "red");

however im not successfull, where is my error?


you are missing a double quotes in the end of href

see demo http://jsfiddle.net/URJPV/1/


try this one:

<a id="contact_link" href="mailto:name@.domain.net>name</a>

$('a#contact_link').css("background", "red");
0

精彩评论

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

关注公众号