Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi Expert!

I have one checkbox that checked and unchecked on description click.

My code as par below
<input type="checkbox" id="chkId" />
<label for="chkId">Check</label>

It work fine with all browsers besides Mozilla (all version), when user click continue on checkbox's description (Mozilla) and on Internet Explorer 10, it work slowly, when user

clicked and unchecked. Why? This is very irritable.

Please give me solution that (checkbox) work properly on all browsers.

Please help me!

Any suggestion will be appreciated.

Thanks in advance!
Posted
Updated 8-Mar-13 6:40am
v2
Comments
ZurdoDev 8-Mar-13 7:20am    
Where's the code?
Zoltán Zörgő 8-Mar-13 13:03pm    
Is it bare html, or is there any javascript event handler attached?
Try it out as bare html also: just save these two lines in a test.html and see.
I have experienced that there is some slowness in Mozilla, but that was around 300ms - somewhat more than with Chrome, but acceptable.

1 solution

Here is the simple solution:

You should not use Label at all, because it is redundant; the check box has its own text. Do something like this:
XML
<input type="checkbox" id="chkId1" accesskey="A">This is option <u>A</u></input><br/>
<input type="checkbox" id="chkId2" accesskey="B">This is option <u>B</u></input>


This way, you will create accelerator keys for each control, according to underlined characters. Remember that in Mozilla, they are accessed via Alt+Shift+key, but on some other browsers via Alt+key.

As to the slow operation, this is not true. You could screw up your performance somewhere else; those controls themselves work just fine, and very fast.

—SA
 
Share this answer
 
Comments
Pravesh Singh 9-Mar-13 3:46am    
I kanow, it work fine when we click on checkbox, but i want to checked checkbox on checkbox text(e.g. "This is option A") click, this work not properly when user continue click on checkbox text.
Sergey Alexandrovich Kryukov 9-Mar-13 19:54pm    
What is not working properly? It all depends on what you write in the handler. In detail please, what's not working. What exactly do you want to achieve?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900