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

  • SEARCH
  • Home
  • 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 8445509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:40:39+00:00 2026-06-10T09:40:39+00:00

I have a jquery buttonset that is populated dynamically. The only problem is that

  • 0

I have a jquery buttonset that is populated dynamically. The only problem is that if there are too many dynamically added buttons, they wrap onto the next line, and don’t do it gracefully. Here is what displays:
(element a|about|us|lorem|
|ipsum|and|done)

The main problem with this is that the element on the far right of the first line, and the element on the far left of the second line don’t have rounded corners, they have square corners like all the other button elements that aren’t in the first or last position of the buttonset. Is there anyways to get a display like so?
(element a|about|us|lorem)
(ipsum|and|done)

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-06-10T09:40:39+00:00Added an answer on June 10, 2026 at 9:40 am

    Using offset() as Peter said is definitely the right direction. After finding the right elements all you need to do is add the .ui-corner-right and .ui-corner-left classes.

    $("#box label").each(function(){   //loop through all the labels for the buttons
        var self = $(this);
        if( self.offset().top > self.height() ){ //find the first element on the second line
            self.addClass("ui-corner-left")
            .prev().prev().addClass("ui-corner-right") // move to the previous label on the above line
            return false;  // break out of the .each
       }
    });
    

    http://jsfiddle.net/KEfau/ Of course this only works for things that are on two lines and the conidition inside the .each() might be different depending on your layout. For multiple lines of buttons I would have a variable which stores the current top offset of the line then when an element doesn’t match it do the class additions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a code in jquery mobile that will add buttons dynamically in a
I have several HTML elements (buttons) that fire the same JQuery AJAX request. When
I created some widgets with jQuery UI and I notice that buttons have a
If I have 3 radio buttons, is there a way through jQuery of finding
I have a problem selecting a checked radio button with jquery. The radio buttons
I have some Radio Buttons that creates in run time and they are inside
I have some buttons that when clicked, invoke jQuery to remove and replace their
I have a simple webpage that uses the jquery template plugin to dynamically load
I have two buttons that were firing functions once clicked on. jQuery was handling
I have items and buttons that are created dynamically and I want to show

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.