Vinay Gayakwad
Vinay Gayakwad

Reputation: 536

Function call works only for one time but doesn't work for next time

I am calling a function which consist of jQuery code to make the div resizable. the resizable functions work correctly for first time.but it doesn't work for second and next time. I added alert to that function to check the call of function.Function calls but the resizable doesn't work.Why is that happening?And what is the solution? the code is here:

function rezDesc() {
    alert('resize');
    $(function () {
        $("#placeDescHere").resizable({
            ghost: true,
            alsoResize: '#LabelDesc',
            handles: " e, s"
        });
    });
}

Upvotes: 0

Views: 1124

Answers (2)

Rory McCrossan
Rory McCrossan

Reputation: 337560

The inner function block is not required.

function rezDesc() 
{
    alert('resizze');
    $( "#placeDescHere" ).resizable({
        ghost: true,
        alsoResize:'#LabelDesc',
        handles: " e, s"
    }); 
}

Upvotes: 1

Alnitak
Alnitak

Reputation: 339786

Take the inner function call out of its $(function() { ... }) block.

function rezDesc() 
{
    alert('resizze');
    $("#placeDescHere" ).resizable({
        ghost: true,
        alsoResize:'#LabelDesc',
        handles: " e, s"
    });
}

Upvotes: 1

Related Questions