0

我有下面的 html 我的 iframe ID 是动态生成的,现在我想更改我的跨度的 html。

<a title="Visit Us on Google+" id="gPlus" class="addthis_button_google_plusone at300b" g:plusone:count="false">
  <div id="___plusone_0">
    <iframe width="100%" scrolling="no" frameborder="0" hspace="0" marginheight="0" marginwidth="0"
    style="position: static; top: 0px; width: 24px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 15px;"
    tabindex="0" vspace="0" id="I0_1363080003291" name="I0_1363080003291"
    src="https://plusone.google.com"
    allowtransparency="true" data-gapiattached="true" title="+1">
        <html lang="en" dir="ltr">
            <head>
            </head>
            <body class="g-rba-Dh-kQa ">
                <div class="Bg" dir="ltr" id="plusone">
                <span id="widget_bounds"><table cellspacing="0" cellpadding="0"><tbody><tr><td>
                <div class="ZRa">
                <span tabindex="0" role="button" title="" class="hAa Ro Bg" id="button" aria-label="Click here to publicly +1 this." aria-pressed="false"><div class="YIa"></div></span></div></td></tr></tbody></table></span></div>
            </body>
        </html>
    </iframe>
  </div>
</a>

现在我想使用 jquery 在“title”标签中添加一些值

<div class="ZRa">
<span tabindex="0" role="button" title="" class="hAa Ro Bg" id="button" aria-label="Click here to publicly +1 this." aria-pressed="false"><div class="YIa"></div></span>
</div>

请推荐!!

4

2 回答 2

0

试试这个,

$(document).ready(function () {
$("#___plusone_0")
    .find("iframe")
    .contents()
    .find(".hAa ")
    .attr('title', 'whatever u want');
 });
于 2013-03-12T10:17:52.660 回答
0

尝试这个

$('#___plusone_0').find('span#button').attr('title','yourTitle');
于 2013-03-12T10:19:36.767 回答