gpt4 book ai didi

javascript - 单击另一个按钮触发共享按钮

转载 作者:太空宇宙 更新时间:2023-11-03 20:43:37 24 4
gpt4 key购买 nike

我有以下代码

<div class="event_starpline">
<div style="width:71%;float:left;">
<div id="starpline_timestamp_location"
title="Location&nbsp;: Chennai">Chennai</div>
<div id="starpline_timestamp_posted"
title="Posted &nbsp;Jan 30, 2013"
style="margin-left:10px;">
<acronym title="30 January 2013 @ 8:58am">471 days ago</acronym>
</div>
<div id="starpline_timestamp_refer"
title="Refer your friends"
style="margin-left:10px;">
<a href="#">Refer your friends</a>
</div>
</div>
<div class="starpline_right" style="width:28%;">
<div style="float:left; width:108px; padding-top:5px;">
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_20x20_style"
addthis:url="http://10.0.1.22/firstplanet/fpin/dev/pg/ad/read/39342/community-developer-4"
addthis:title="Community developer 4"
addthis:description="Job" description="">
<a class="addthis_button_twitter addthis_button_preferred_2 at300b"
title="Tweet" href="#">
<span class=" at300bs at15nc at15t_twitter">
<span class="at_a11y">Share on twitter</span>
</span>
</a>
<a class="addthis_button_facebook addthis_button_preferred_1 at300b" title="Facebook" href="#">
<span class=" at300bs at15nc at15t_facebook">
<span class="at_a11y">Share on facebook</span>
</span>
</a>
<a class="addthis_button_email addthis_button_preferred_3 at300b"
target="_blank" title="Email" href="#">
<span class=" at300bs at15nc at15t_email">
<span class="at_a11y">Share on email</span>
</span>
</a>

<div class="atclear"></div>
</div>
<script type="text/javascript">
var addthis_config = {
"data_track_addressbar": true
};
</script>
<script type="text/javascript"
src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-510b54196b4318c8"></script>
<div id="_atssh"
style="visibility: hidden; height: 1px; width: 1px; position: absolute; z-index: 100000;">
<iframe id="_atssh679"
title="AddThis utility frame"
src="//ct1.addthis.com/static/r07/sh158.html#iit=1400219038582&amp;tmr=load%3D1400219036211%26core%3D1400219036863%26main%3D1400219038575%26ifr%3D1400219038590&amp;cb=0&amp;cdn=0&amp;chr=UTF-8&amp;kw=open%20source%2Cfirst%20planet%2Cfirstplanet%2Cjob%20seekers%2Cunemployment%2Cfreshers%2Crecruitment%2Ctraining%2Cjobs%2Cinformation%20technology%2CIT%20Job%2Cwalkins%2Csatori%2Clamp%2Cdotnet%2Cjava%2Cchennai%2Canna%20salai%2Ctechnologies&amp;ab=-&amp;dh=10.0.1.22&amp;dr=http%3A%2F%2F10.0.1.22%2Ffirstplanet%2Ffpin%2Fdev%2Fpg%2Fsearch%2F%3Ftag%3Da%26entity_subtype%3Dad%26entity_type%3Dobject%26search_type%3Dentities&amp;du=http%3A%2F%2F10.0.1.22%2Ffirstplanet%2Ffpin%2Fdev%2Fpg%2Fad%2Fall%2F&amp;dt=First%20Planet%3A%20Job%20posts&amp;dbg=0&amp;md=0&amp;cap=tc%3D0%26ab%3D1&amp;inst=1&amp;vcl=1&amp;jsl=1&amp;prod=undefined&amp;lng=en-US&amp;ogt=&amp;pc=men&amp;pub=ra-510b54196b4318c8&amp;ssl=0&amp;sid=5375a59c9ed1ff23&amp;srpl=1&amp;srcs=1&amp;srd=1&amp;srf=1&amp;srx=1&amp;ver=300&amp;xck=0&amp;xtr=0&amp;og=&amp;aa=0&amp;csi=undefined&amp;rev=1399981304&amp;ct=1&amp;xld=1&amp;xd=1&amp;fcu=U3WlnIGSxBl"
style="height: 1px; width: 1px; position: absolute; z-index: 100000; border: 0px; left: 0px; top: 0px;">
</iframe>
</div>
<script type="text/javascript"
src="http://ct1.addthis.com/static/r07/core131.js"></script>
<!-- AddThis Button END -->

我希望当我点击Refer your friends 时它会触发addthis_button_email addthis_button_preferred_3 at300b 并且它会显示一个弹出窗口。

我试过下面的代码

jQuery("div#starpline_timestamp_refer").click(function(){
// trigger second button
jQuery(".addthis_button_email addthis_button_preferred_3 at300b").click()
return false;
});

好吧,现在看看它是如何触发的。

实际上它是一个元素列表。我只展示了一件商品。所以每次我点击它都会获取最后一项属性。我们可以从列表中正确选择一项吗?我们怎样才能做到这一点?

最佳答案

您缺少类选择器 [dot] 并删除选择器之间的空格:

jQuery(".addthis_button_email.addthis_button_preferred_3.at300b").click()
// here ^^ and here ^^

关于javascript - 单击另一个按钮触发共享按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23693580/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com