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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:40:44+00:00 2026-05-29T04:40:44+00:00

I need some help. I have a div inside which there are some radio

  • 0

I need some help. I have a div inside which there are some radio buttons generated dynamically with a piece of text next to each radio button also generated dynamically, inside a element, like below:

<div class="mother_div"> 
   <input type="radio" class="child_radio" name="amount" value="0" />
   <span class="child_text">0.0 some text</span>
   <input type="radio" class="child_radio" name="amount" value="1" />
   <span class="child_text">1.0 some text</span>
   <input type="radio" class="child_radio" name="amount" value="2" />
   <span class="child_text">2.0 some text</span>
   <input type="radio" class="child_radio" name="amount" value="3" />
   <span class="child_text">3.0 some text</span> 

I need a Jquery method or function that would allow me to start with the mother_div and upon user clicking/checking a radio button (they are all unchecked to start with), to replace the text inside the span with the “child_text” class with a different string of HTML.

What I tried so far is this, but it doesn’t work:

$("div.mother_div input:radio[name=child_radio]").click(function() {
    var newHTML= "some HTML to insert";
    $(span.child_text).html(newHTML);
});

Any thoughts or suggestions highly appreciated.

  • 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-29T04:40:45+00:00Added an answer on May 29, 2026 at 4:40 am

    Try this

    $("div.mother_div input").click(function() {
       var newHTML= "some HTML to insert";
       //this will change text next to radio button clicked
       $(this).next('span.child_text').html(newHTML);  
    
       //this will change text next to all the radio buttons
       $(this).parent().children('span.child_text').html(newHTML);
    });
    

    Your Selector is invalid. You can check change clicked one only or change all demo on jsFiddle.net

    Hope this works for you.

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

Sidebar

Related Questions

I need some help. I have a div wrapper and some other div's inside
Need some help to solve this. I have a gridview and inside the gridview
I need some help from the shell-script gurus out there. I have a .txt
I need some help about WCF and authorization. Currently I have a client which
Hi JQuery Masters i need some help from you, i have some div's <div
I need some jQuery ajax help. I currently have a main content div that
I have bulk images inside a div element so I need to give some
Need some help about with Memcache. I have created a class and want to
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded
Need some help, please. I have a line of horizontal thumbnails loaded as ONE

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.