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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:34:17+00:00 2026-05-24T08:34:17+00:00

Hi i have a radio button( StarRating radiobutton using jquery) and a textbox. When

  • 0

Hi i have a radio button(StarRating radiobutton using jquery) and a textbox. When i click on the star, i would like the radiobutton value to display to the textbox.

<input id="InsRating1" class="star" type="radio" name="InsRating" value="1" title="Worst"/>
<input id="InsRating2" class="star" type="radio" name="InsRating" value="2" title="Good"/>

I tried put the Onclick() in the but onClick() has never get fired.
Please advice how to get the value from my radiobutton to textbox. Thanks

I tried this below, but the value is “Undefined”

$(document).ready(function() {

    $('#InsRating1').click(function() {
        alert(this.value)

    });

});

————-Edit———-
I am using g_thom’s answer below but come to this problem :
I have 3 set of stars with 3 textboxes. Each rating should show to only 1 textbox.
However whenever any star is clicked, it shows the value to all 3 textboxes instead of just specified one. Please advice. Thanks

<script type="text/javascript">

$(function() {
$(‘.star-rating’).click(function() {
// assign the value of “total stars” to a textbox with an id of ratingText
$(‘#EvaluationInstructorRatingTextBox’).val($(‘.star-rating-on’).length);
});
$(‘.rating-cancel’).click(function() {
// the value is ‘0’ when the cancel button is clicked
$(‘#EvaluationInstructorRatingTextBox’).val(‘0’);
});

$('.star-rating').click(function() {
    // assign the value of "total stars" to a textbox with an id of ratingText
    $('#EvaluationMaterialRatingTextBox').val($('.star-rating-on').length);
});
$('.rating-cancel').click(function() {
    // the value is '0' when the cancel button is clicked
    $('#EvaluationMaterialRatingTextBox').val('0');
});


$('.star-rating').click(function() {
    // assign the value of "total stars" to a textbox with an id of ratingText
    $('#EvaluationValueRatingTextBox').val($('.star-rating-on').length);
});
$('.rating-cancel').click(function() {
    // the value is '0' when the cancel button is clicked
    $('#EvaluationValueRatingTextBox').val('0');
});

});

  • 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-24T08:34:18+00:00Added an answer on May 24, 2026 at 8:34 am

    Since the inputs are converted to divs (with the ‘rated stars’ being assigned a different class), I think you’ll want to count the number of divs with the .star-rating-on class and assign that value to the input, like this:

    $('.star-rating').click(function() {
        // assign the value of "total stars" to a textbox with an id of ratingText
        $('#ratingText').val($('.star-rating-on').length);
    });
    

    Boring looking example – without the actual graphics/animations (just the HTML from the transformed inputs on plugin page – the value will always be 4): http://jsfiddle.net/bhf2d/

    EDIT

    The code above should work. I think you may be thinking that you need to apply your jQuery to the radio button, but that’s not the case, since it is swapped out on page load with a div. Just in case you’re not clear, I’ve added a live example using the code you provided in your question: Click here to see it.

    EDIT 2

    See an updated version here, matching the additional requirement to set multiple checkboxes. The textboxes have been renamed slightly (InsRatingText0 etc) to facilitate easily adding more items. The name convention InsRatingText[n] is set that way to match the div classes the plugin adds dynamically (‘rater-0’, ‘rater-1’, etc)

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

Sidebar

Related Questions

I have a radio button like this <input type='radio' name='specific_consultant' id='specific_consultant_no' value='no'>No</input> on .on
I have a radio button something like this, <input type=radio value=A name=NodeLevel /> When
I have a radio button group like this : <g:radioGroup name=myGroup values=[1,2,3] value=1 >
I have two radio button <input tabindex=3 type=radio name=gender id=gender value=M>Male&nbsp;<input tabindex=4 type=radio name=gender
I have several radio button that look like this: <div id=TheOptions> <input type=radio name=mylist/>option
I have a radio button that I would like to be able to enable
I need to obtain the value of a radio button using javascript I have
I have a problem selecting a checked radio button with jquery. The radio buttons
So, I have radio boxes of the form <li><input type=radio name=names value=blah><a>Some text (blah)</a></li>
I have radio buttons like this: <div id=radio> <input type=radio id=radio1 name=radioOption /><label for=radio1>Choice

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.