Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET HTML MVC
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 8-Mar-13 1:04am
Edited 8-Mar-13 7:40am
v2
Comments
ryanb31 at 8-Mar-13 7:20am
   
Where's the code?
Zoltán Zörgő at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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:
<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
  Permalink  
Comments
Pravesh Singh at 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 at 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)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 Richard MacCutchan 145
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,712
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 8 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100