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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:28:10+00:00 2026-06-12T15:28:10+00:00

jQuery $(document).ready(function () { $(‘#ButtonRadioValue’).click(function () { var selValue = $(‘input[name=radio]:checked’).val(); }); }); Radio

  • 0

jQuery

$(document).ready(function () {
        $('#ButtonRadioValue').click(function () {
            var selValue = $('input[name=radio]:checked').val();
        });
    });

Radio

<div id="radio" align="center">
    <input type="radio" id="radio1" value="BtnNextCaseClick" name="radio" checked="checked"/><label for="radio1" style="width: 109px; margin-right:-.9em">Next</label>
    <input type="radio" id="radio2" value="CloseCase" name="radio" /><label for="radio2" style="margin-right:-.9em">Close Case</label>
    <input type="radio" id="radio3" value="CloseWeb" name="radio" /><label for="radio3" style="width: 109px">Close Web</label>
</div>   

So, below that radio I have a button, and I want it to execute different code behind according to radio selection. That value is stored in selValue. So how can I tell onclick event to run what’s inside of selValue

Button

<asp:Button ID="ButtonRadioValue" CssClass="customButton" runat="server" onclick=" js variable here" Text="Aceptar" style="width: 111px; height: 30px"/>

Thanks.

EDIT

Since there was no real need for client-side procedure. I did it from Server side with this.radio1.Checked == 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-06-12T15:28:12+00:00Added an answer on June 12, 2026 at 3:28 pm

    Update: It appears I have misunderstood what is required, so I will leave my original below

    If you want to know which radio button was selected on the post-back, then either make the radio’s server-side controls (either by converting into <asp:RadioButton> or simply adding runat="server" to them. Then you can test for radio1.Checked, etc.

    Otherwise you can check the form data using Request.Form("radio1"). If result is Nothing (VB.Net) or null (C#) then the radio was not selected. If there is a value there, you know the radio is selected.


    Original / incorrect assumption

    Unless I’ve misunderstood the issue, you don’t need to have a special attribute in the <asp:Button> as you can do this just in the jQuery you’ve already written.

    Add the following after your var selValue...

    $("#" + selValue).trigger("click");
    

    To produce…

    $(document).ready(function () {
        $('#ButtonRadioValue').click(function () {
            var selValue = $('input[name=radio]:checked').val();
            $("#" + selValue).trigger("click");
        });
    });
    

    One thing to note is that if the control is within Master Page, Placeholder, etc, then the button will need the full ClientID, otherwise the jQuery will not find it


    As a side note, the OnClick attribute of the <asp:Button> is used to wire-up the event handler for the click on a post-back to the server. If you want to run javascript then you want to use the OnClientClick attribute, which will produce an onclick attribute in the rendered HTML

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

Sidebar

Related Questions

HTML: <input type=text id=priceperperson1 name=priceperperson1 /> <input type=text name=personsvalue1 class=countme readonly=readonly /> JS: jQuery(document).ready(function($)
I have a jqGrid script like that: jQuery(document).ready(function() { var startDate = $(#startDate).Val(); jQuery(#sandgrid).jqGrid({
jQuery(document).ready(function(){ // Set the data text var dataText = { name: 'John', time: '2pm'
I wrote this function: jQuery(document).ready(function() { jQuery('input[type=text]').each( function(i) { thisval = jQuery(this).val(); jQuery(this).blur( function()
jQuery(document).ready(function(){ $(#button).submit(function() { { var email_id=document.getElementById('textfield').value; var password=document.getElementById('textfield2').value; var utype=document.getElementById(utype).value; var url=login_check.jsp?&email_id=+encodeURIComponent(email_id)+&password=+encodeURIComponent(password)+&utype=+encodeURIComponent(utype); $('form').get(0).setAttribute('action',url); alert(document.form1.action);
On document ready I run this code: jQuery(document).ready(function(){ jQuery('#button').click(function() { jQuery('#contact_form').load(/Users/mge/Downloads/jquery-ajax-1/readme.txt); return false; });
load.js: jQuery(document).ready(function($) { $('.dialog ul li').click(function(e) { switch($(this).attr('id')) { case 'addProject': $('.addDialog').load('/add/addprojectform'); break; case
I have updated my jSon object using the code <script type=text/javascript > jQuery(document).ready(function($){ var
I got the following code : <script type=text/javascript> jQuery(document).ready(function(){ var Opened = false; jQuery('.expend-schedule').click(function(e){
jQuery(document).ready(function(){ var panelContainer = jQuery('div#panels'); jQuery('<div id=tabs></div>').insertBefore(panelContainer); panelContainer.find('div.panel').each(function(n){ jQuery('div#tabs').append('<a class=tab href=#' + (n+1) +

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.