【发布时间】:2013-08-13 13:41:49
【问题描述】:
我需要获取下一个 textarea,但我无法使用 next 甚至 find。
示例代码 HTML:
<div>
<div class="guides_chapters_button" onclick="surroundtest('[center]', '[/center]');">Center</div>
<div class="guides_chapters_button" style="text-decoration: underline;" onclick="surround('[u]', '[/u]');">u</div>
</div>
<textarea class="guides_chapters_textarea" id="textareamatch" name="matchupm" rows="7" cols="25"></textarea>
JS:
window.surround = function surround(text2,text3){
$("#textareamatch").surroundSelectedText(text2, text3);
}
function surroundtest(text2,text3){
var c = $(this).parent().next('textarea');
c.surroundSelectedText(text2, text3);
}
JS FIDDLE:http://jsfiddle.net/qmpY8/1/
我需要使用的是环绕测试,另一个是使用 id 的示例。我很想替换那个,因为我正在使用克隆对象。
【问题讨论】:
标签: javascript textarea next