jQuery,元素获取问题,谢谢。

jQuery,元素获取问题,谢谢。

问题描述:

 <div>
                    <input type="checkbox" id="che3" name="che2" mtype="che:10:10" value="a4"/>a4  
                    <input type="checkbox" mtype="che:10:10" id="che4" name="che2" value="a6"/>a6 
                    <span></span>
                </div>

怎么获取id=che3的相临span,想通过append插入数据。

 <div>
    <input type="checkbox" id="che3" name="che2" mtype="che:10:10" value="a4" />a4
    <input type="checkbox" mtype="che:10:10" id="che4" name="che2" value="a6" />a6
    <span></span>
</div>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js"></script>
<script>
    $('#che3').siblings('span').filter(':last').html('abc')
</script>

$("#che3").siblings("span")

var span=$("#che3")~$("span"):first

在SPAN 上也加上ID就好了
直接获取SPAN

$("#che3 span").innerHTML()