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 7609749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:14:57+00:00 2026-05-31T01:14:57+00:00

i have a problem in grouping a dynamically generated radio buttons into a jQuery

  • 0

i have a problem in grouping a dynamically generated radio buttons into a jQuery Mobile control group, i generate the radio buttons and append them into a but they are dispalayed separetly although there warping contains a ‘controlgroup’ data-role, here’s my HTML:

<div data-role="collapsible" data-inset="true">
    <h1>AddVote</h1>
   <div data-role="fieldcontain" >
   <form id="voting" action="get">
      <label for="name">&nbsp;&nbsp;&nbsp;&nbsp;<strong>Question:</strong></label>
<input type="text" name="name" id="name" value=""  /><br>

 <label for="name"><div id="AddButton" data-role="button" data-inline="true">AddOptions</div></label>

<input type="text" name="option" id="option" value=""  /><br>
<div id="RemoveButton" data-role="button" data-inline="true">RemoveOptions</div>




  <div  data-role="fieldcontain">
<fieldset data-role="controlgroup">
    <legend>&nbsp;&nbsp;&nbsp;&nbsp;<strong>Choose an Option:</strong></legend><br><br>
     <fieldset data-role="controlgroup">
    <div id="after" data-role="controlgroup" >

     ///////////////////////Generated radio buttons goes here//////////////////////
    </div>
    </fieldset>
    </fieldset>


  </div>
    </div>
   <a href="#" data-role="button" data-inline="true" >Publish</a>
    </form>

and here’s the script code:

function createRadioElement(elem, label, checked) {
var id = 'option1_' + label;

$('#after').append($('<input />', {
    'type': 'radio',
    'name': 'option1',
    'id': id,
    'data-role': 'controlgroup',
    'data-theme':'e',
    'value': '1'

 }));
$('#after').append('<label for="' + id + '">' 
                    + label + '</label><br />').trigger('create');

     }

$( '#admin' ).live( 'pageinit',function(event){
 $('#AddButton').click(function(){
var x = document.getElementById('option').value;     
createRadioElement(this,$('#option').val(),true);

});
  • 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-31T01:14:58+00:00Added an answer on May 31, 2026 at 1:14 am

    Perhaps I don’t understand the question correctly but is it the <br /> between the radiobuttons that concerns you? If this is the case then just replace this:

    $('#after').append('<label for="' + id + '">' 
                        + label + '</label><br />').trigger('create');
    

    with this:

    $('#after').append('<label for="' + id + '">' 
                        + label + '</label>').trigger('create');
    

    Also I believe that your <form> and <div> tags are incorrectly nested.

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

Sidebar

Related Questions

I have a problem with group expressions in a list. I want to use
I have a problem with this SQL Grouping. If i have a table with
I'm having a problem with grouping in SQL Server. I have a datetime column
I have a very simple grouping and aggregation problem in LINQ to SQL that
Hello I have a problem when grouping the OpenCV's functions in functions of my
I have an interesting problem. I have to assign an ID to a group
I have a problem that I believe I need to use grouping using xsl:key
I need to solve a groping problem in my xsl; I have to group
I have a problem using JPA with Oracle and grouping by hour. Here's the
I have problem in some JavaScript that I am writing where the Switch statement

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.