By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,481 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,481 IT Pros & Developers. It's quick & easy.

Internet Explorer onChange issue

P: 2
Hello ppl,

i am using onChange method on radio buttons. the following code works fine in firefox. in IE it does nothing until you click somewhere else on the screen (or even if you click again on the same radio button)

Expand|Select|Wrap|Line Numbers
  1. function changed(fname) 
  2. {
  3.     if (fname=='InfoSources_1') 
  4.    {
  5.       if (document.form1.InfoSources_1[1].checked) 
  6.        {        document.getElementById('optional2').style.display='none';
  7.         } 
  8.      else 
  9.        {                    document.getElementById('optional2').style.display='';
  10.        }
  11.     }
  12. }
is there some additional method i need for IE to recognise the onChange event so that the second click is not necessary?

any advice most appreciated, cheers :)
Sep 20 '06 #1
Share this Question
Share on Google+
2 Replies

P: 2
aha!!! just found if i use onClick it works in both .......... expect more ramblings from me in future ;)
Sep 20 '06 #2

P: 1
The way I've found to get around this is to send a .blur() method to the radio button when it is clicked:

<input type="radio" onchange="dosomething(this.value)" onclick="this.blur()" name="radio_set" value="1" />

This forces Internet Explorer to trigger the onchange event.

Oct 24 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.