Solved

jquery issue with radio buttons

Posted on 2014-07-30
5
242 Views
Last Modified: 2014-07-30
Hi I want to do the work which is done on radio button click  in button(named Button1) click, kept blank below, Please help

 <script type="text/javascript">

         $(document).ready(function () {
             $(".myRadios").bind("click", function () {          

                 alert($(this).val());
           
                 alert($(this).closest("td").next("td").html());
                 alert($(this).closest("td").next("td").next("td").html());
             });

            $(".btncss").bind("click", function () {

             });
       });

     </script>
     <div id="abc">
         <br />
         <br />
         <table id="tbl">
             <tr>
                 <td>
                     <input class="myRadios" name="abc1" id="abc1" type="radio" value="1" /></td>
                 <td>11</td>
                 <%--<td>22</td>--%>
             </tr>
             <tr>
                 <td>
                     <input class="myRadios" name="abc1" id="abc1" type="radio" value="2" /></td>
                 <td>22</td>
                 <td>33</td>
             </tr>
             <tr>
                 <td>
                     <input class="myRadios" name="abc1" id="abc1" type="radio" value="3" /></td>
                 <td>33</td>
                 <td>44</td>
             </tr>
             <tr>
                 <td>
                     <input class="myRadios" name="abc1" id="abc1" type="radio" value="4" /></td>
                 <td>44</td>
                 <td>55</td>
             </tr>
         </table>
         <input id="Button1" type="button" value="button" class="btncss" />
     </div>

Open in new window

0
Comment
Question by:Dinesh Kumar
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40229502
If I understand just disable the button in the onclick function

$("#Button1").attr("disabled",true)
0
 

Author Comment

by:Dinesh Kumar
ID: 40229514
the problem is that whenever I click on Button1

I will check if radio button is selected then I want to pick values from corresponding two <td>s

e.g if I select second radio button and then press the Button1 then corresponding td are  <td>22</td>                <td>33</td> I should be able to get those values.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40229544
http://jsfiddle.net/GaryC123/C4eQB/

$(document).ready(function () {
    $("#Button1").click(function () {
        if ($(".myRadios").is(':checked')) {
            el = $(".myRadios:checked").closest("td").next("td")
            alert(el.html());
            alert(el.next("td").html());
        }
    });
});

Open in new window

0
 

Author Closing Comment

by:Dinesh Kumar
ID: 40229581
Thank you very much!!
0
 

Author Comment

by:Dinesh Kumar
ID: 40229583
It worked like a bolt :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
dynamics crm 2011 - Web Resources 1 24
Chat Room 1 25
jQuery Scroll Speed 3 18
Visual Studio 2013 debugging 2 16
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now