3

I want to use jquery ui button for buttons created in future. can i use live()? what is eventType in live()?

3 Answers 3

5

You can download the .livequery() plugin, which should give you the same functionality:

$(".button").livequery(function() {
  $(this).button();
});

.livequery() plugin: http://plugins.jquery.com/project/livequery

As far as I know there is no way to use live with the JQuery UI button. This SO question might also be helpful: Adding jQueryui Buttons to dynamically added content

Sign up to request clarification or add additional context in comments.

Comments

0

There is a way to do this. The jquery ui button call adds "ui-button" as a class to either the element or the element's label (in the case of radio/checkbox). You can grab the elements with the "ui-button" class and do "live" functions against those elements.

So if your html is...

<div id="parent_div">
    <input type="checkbox" id="test_checkbox" />
    <label for="test_checkbox">Test</label>
</div>

then your script would be...

$(function() {
    $("#parent_div .ui-button").live("mouseenter", function (e) {
        // code to show something here
    });
});

Comments

0

I use this solution:

content.load('URL #sectionToLoad', function(event) {
    $("SELECTOR, button").button();
    ...
});

It's work fine

UPDATE

Use delegate to assign Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. jQuery API: link, instead of live method, and don´t forget to undelegate the event.

Hope this help you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.