[resolved] Widgets with jQuery (2 posts)

  1. mattyrob
    Posted 5 years ago #

    I have a widget that uses a jQuery colorpicker.

    If the Widget is added to the sidebar and the page is then reloaded the colorpicker script links correctly to it's bound fields. However if the page is not reloaded and the Widget is added from the list of currently inactive widgets the color picker code fails to 'attach'. I've tried using the .live() method without success with the code below.

    So, is it possible to ensure the jQuery colorpicker code attaches to fields that are created on a page after the DOM 'ready'? Is so, how?

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. mattyrob
    Posted 5 years ago #

    Too bad the code was moderated but anyway, I've been messing about for several hours trying .live, .delegate and other jQuery possibilities.

    My first instinct was right thought and I've got .live working! Yippee!!

    For anyone else that needs some jQuery events to work when you drop a new widget but does not want to reload the widget page first, here is how I am doing int:


Topic Closed

This topic has been closed to new replies.

About this Topic