khidotlua
khidotlua

Reputation: 1

change style of div after dragdrop

I have a div and a button. After drag&drop this div object to other position. I want that when I click button, that div object will change style with new position has just changed.

Div object change postion:

div id="divml5" class="dragDiv1" runat="server" style="width:40px;height:40px;

position:relative; left:120px;top:60px;">**
    'table> 
       **tr>
            td>
                h5 id="h5ml5" class="handler" runat="server" 
                        style="background-image:url('../../Images/image.jpg'); 
                                vertical-align:middle;width:40px; height:40px;background-repeat:no-repeat;"></h5>
            /td>
        /tr>**
    /table>
/div>"

Button

button type="button" id="btn" runat="server" onclick="changeStyle();">ChangeStyle

and I have paragrahp code to process change style of that div object:

var divml5 = document.getElementById("divml5"); var h5ml5 = document.getElementById("h5ml5");

    function changeStyle(){
        h5ml5.style.backgroundImage = "url('../Images/clientRed.jpg')";
    }

I think I can implement as I want, but it can't process.

Upvotes: 0

Views: 406

Answers (1)

D.J
D.J

Reputation: 2534

If I understand ur question correctly.

I would suggest you do it in 2 steps:

1, define your new style into a Css class

2, use jQuery AddClass('ur_class_name') on .click()

Upvotes: 0

Related Questions