Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6971985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:54:35+00:00 2026-05-27T16:54:35+00:00

I have the following code working nicely: $field2.on(change, #selector, function(){ $field2.load(./index.php?show-options=true, { value: $(this).val()

  • 0

I have the following code working nicely:

    $field2.on("change", "#selector", function(){
        $field2.load("./index.php?show-options=true", { value: $(this).val() }, function() {
        $("#options").buttonset();
        });
    });     

It loads the #options div and applies button to anchor tags within it.

Is there a way to declare

$("#options").buttonset();

BEFORE the #options div is loaded?

I looked through jQuery docs with no success, and also found this answer:

Apply jQuery UI widgets to ajax loaded elements

which I think might be on track, but haven’t understood it fully nor managed to implement.

Help appreciated, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:54:36+00:00Added an answer on May 27, 2026 at 4:54 pm

    Doing the following:

    $field2.on("change", "#selector", function(){
        $field2.load("./index.php?show-options=true", { value: $(this).val() }, function() {
          $field2.find("#options").buttonset();
        });
    });
    

    Will make all option elements within $field2 into a button set (once the content has been updated).

    Or alternatively you could make the button set on dom ready:

    $(function() { $("#options").buttonset(); });
    

    Update

    jQuery selectors work on elements in the DOM (unless given a context), if the element is not in the DOM then unfortunately jQuery will not be able to affect it directly. If the load then call to buttonset is causing a FOUC (flash of unstyled content), you could try the following:

    $field2.on("change", "#selector", function() {
        $field2.empty();
        $.get("./index.php?show-options=true", { value: $(this).val() }, function(data) {
          var newContent = $(data);
          $("#options", newContent).buttonset();
          $field2.empty().append(newContent);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jquery code working fine: $('iframe#captcha')[0].contentDocument.location.reload(true); $('input#captchainput').val(''); $('img#ajaxLoader').hide(); $('h3#loginFailed').show(); Is it
On a Solaris 5.8 machine, I have the following code: [non-working code] char *buf;
I have the following code and it's working (as usual) in everything but IE.
Im trying to get debugging working without an app.config. I have the following code:
I have the following Clojure code and I'm not sure why it's not working:
Any idea why the following code is not working mysql credentials are correct, have
I have the following code working with a DataGrid that has two column Column_A
I have the following code working fine but the problem is that it always
I have the following code working fine, but I'm unable to add a zoom
Ok, firstly I have the following code working.. although my question is this; should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.