开发者

Moving button element to different div(parent) using JavaScript

I have a button on a aspx page should be positioned on table for one criteria and for other it should be positioned on different div (I dont have the access to code behind for programmatic adding ) all i have to do is though javascript what would be the best way to move the button position?

<div id= "main">
    <table>
        <tr><td id="loginsbtbtn"></td><tr>
    <ta开发者_JAVA技巧ble>
    <div id="cbtn">
        <asp:Button ID="btnSubmit"  BackColor="#b5c7de" runat="server" Text='continue' /> 
    </div>
</div>

Thanks in advance


Using jQuery, do this:

$('#myButton').appendTo('#someDiv');

Without jQuery, do this:

document.getElementById('someDiv').appendChild(document.getElementById('myButton'));

This assumes the targeted elements have ID attributes. Impossible to give an exact solution without any HTML in the question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜