Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This code will give me the widget ID if the widget is moved at all after the initial placement.

    jQuery('div.widgets-sortables').on('sortstop',function(event,ui){           
        console.log(ui.item[0].id);
    });

On the first drop it is undefined as I suspect that the DOM has not been rebuilt. This is when I need it. In the end I need some javascript to fire when a widget is newly created and I need the specific widget ID for form manipulation. This isn't a new request...seen it before. Never a complete solution.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.