我正在嘗試獲取下一個元素的innerHTML
,在其旁邊發生了Click。使用Prototype獲取點擊事件上next()元素的innerHTML
到目前爲止,我有這個作爲我的代碼
$('translate_this').observe('click', function(e) {
// Immediately stop the click through
Event.stop(e);
x = this.next().innerHTML;
alert(x);
});
但是,沒有實際發生,這表明該變量沒有被任何東西填充的。爲什麼是這樣。
HTML參考
<li class="say public">
<p>
<span style="padding: 2px 7px; background-color: rgb(230, 230, 230); -moz-border-radius-topleft: 6px; -moz-border-radius-topright: 6px; -moz-border-radius-bottomright: 6px; -moz-border-radius-bottomleft: 6px;">
<a id="translate_this" href="">Translate</a>
</span>
</p>
<div class="post_non_translated">
<p>Bonjour </p>
</div>
</li>
嘎!當然,現在這很合理 - 謝謝! – jakeisonline 2009-12-11 12:41:44