Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    64
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question form :checked doesn't work ?

    hi am experiencing this weird stuff while trying to learn jquery.
    why is the "form :checked" selected doesn't work on FF and Chrome ?, but it works on IE8

    here's an html snippet (incomplete, just for showing example)
    Code:
    <input id="Checkbox1" type="checkbox" checked="checked"/><label for="Checkbox1">Widgets</label><br />
                <input id="Checkbox2" type="checkbox" /><label for="Checkbox1">Hibbity Jibbities</label><br />
                <input id="Checkbox3" type="checkbox" checked="checked"/><label for="Checkbox1">SplashBangers</label><br />
                <input id="Checkbox4" type="checkbox" /><label for="Checkbox1">Whatzits</label></td>
    and here's the jquery stuff

    Code:
    <script type="text/javascript" src="../jquery.js"></script>
    <script type="text/javascript">
        $("document").ready(function() {
          $('form :checked').css('border','3px solid red');
        });
    </script>
    i don't know why it doesn't work in my primary browsers but it works with the annoying IE8

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,607
    Thanks
    6
    Thanked 997 Times in 970 Posts
    Quote Originally Posted by capt_nemo777 View Post
    why is the "form :checked" selected doesn't work on FF and Chrome ?
    Because you can’t style form controls very well. Specifically checkboxes and radio buttons aren’t very flexible when it comes to styling. And on Mac they have the Aqua look, no matter what you try. Best is to just forget about it and leave them as they are. Alternatively you can add an element (e. g. a span) after the checkboxes while positioning the checkboxes outside of the viewport. Then you style these spans with custom checkbox background graphic and assign an onclick event that makes the span look different and also checks the checkbox (that is out of sight).

  • Users who have thanked VIPStephan for this post:

    capt_nemo777 (03-21-2010)

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    64
    Thanks
    12
    Thanked 0 Times in 0 Posts
    thanks for clarifying that up sir.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •