开发者

make span selection go to parent div

I have a span inside a div.

.myspan {
    float:right;
}
<div>john, doe                    <span class="myspan">(male)</span></div>

Is th开发者_如何学编程ere a way if the user clicks or hovers over the span I can make those events go to the parent div?


The events bubble up to the parent element by default. You don't have to do anything.


If you want to access the parent, you can always say

(this).parent();

but i am not clear what is your requirement

as Matti said , by default events propogates to parent...

read this

http://api.jquery.com/event.stopPropagation/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜