Solved

JS onchange() /onclick() event in Radio button in IE7/6 does not give the desired result

Posted on 2008-10-05
3
1,942 Views
Last Modified: 2013-11-19
Hello I am facing a werid JS issue on IE (works on Firefox ).The onchange() event for a Radio button works weirdly for IE where the value is not shown in the first time of onchange() .and the oder is all messed up.

<div id="reservation">
            <p><b>Reservations</b></p>
                    <label><input id="reservation-hourly" onclick="reservationype();" type="radio" name="reservation_type" value="ac"/> AC</label>
                <label><input id="reservation-structured" onclick="reservationType();" type="radio" name="reservation_type" value="nonac"/> Non-AC</label>
           
</div>



function reservationype(){
    var value_type = $('#reservation input[type=radio][name=reservation_type]:checked').val();
    if(value_type == 'ac'){
        $('#ac').show();
        $('#non-ac').hide();
    }
 else if (value_type == 'nonac'){
        $('#non-ac').show();
        $('#ac').hide();
    }
}
0
Comment
Question by:micro_learner
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
Badotz earned 500 total points
ID: 22644215
One of these things is not like the other:

onclick="reservationype();
onclick="reservationType();

Looks like you dotted all the "eyes", but missed crossing a "tee" ;-)
0
 

Author Closing Comment

by:micro_learner
ID: 31503159
That one and also using the onclick solved the problem.Thanks
0
 
LVL 29

Expert Comment

by:Badotz
ID: 22644278
No worries - glad to help.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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…

773 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