views:

101

answers:

4

This is my selectall button code..on clicking this i am selecting all checkboxes..

   $('#PbtnSelectAll').click(function() {
        $('#PricingEditExceptions input[type=checkbox]').attr('checked', 'checked');
            $('#PbtnSubmit').show();
            $('#PbtnCancel').show();
            $('fieldset').find("input:not(:checkbox),select,textarea").attr('disabled',true);
            $('#genericfieldset').find("input,select,textarea").removeAttr('disabled');
        });

This code working in Firefox not in IE can anybody help me out why its doing like this?

thanks

A: 

Check the id's of all your elements. I'd be using .PbtnSelectAll etc and giving each element a class of the same. At least the class doesn't change like the name can.

griegs
Would not make a difference, the its not the DOM that selects the elements its the Sizzle in jQ, if it works in firefox it should work in IE, the only thing thats manipulating the dom is the attr, wich may be the issues with the value of checked
RobertPitt
i tried as RobertPitt and contagious sujjested but still no luck
kumar
@RobertPitt and how do you think Sizzle evaluates #id? It uses `document.getElementById()` - it is a sure recipe for problems to re-use element "id" values
Pointy
@pointy,I know this, but what i was saying is that Sizzle traverse CSS/Attributed using Regex to create an identical system to CSS Selectors, my point was if `#someId[data-name*='rob']` works in FFX, it will also be found within IE,Chrome,Safari. Sorry for my confusion.
RobertPitt
Well, I don't think that's actually always true, @RobertPitt. I think that the engine locates "id" references (#foo) and uses document.getElementById - therefore if there are multiple elements with the same "id" value, something weird can happen.
Pointy
correct, witch is why i prefer to use a data-* attribute to hold meta data for that element, such as <a href="#" data-json="{....}"></a> and use that to traverse elements. what he needs to do is not use id's but classes,data-* attributes to select his elements.
RobertPitt
OK, now we're in agreement :-)
Pointy
A: 

try using "#Fieldset input:checkbox" as your selector.

contagious
i give it a shot..
kumar
Have you experienced varying results when using `:checkbox` as opposed to `[type=checkbox]`?
patrick dw
no same thing happening..thanks patrick
kumar
A: 

Try using a boolean instead

$('#Fieldset input[type=checkbox]').attr('checked',true);

RobertPitt
A: 

Try to use true , false boolean. Can you try http://www.iknowkungfoo.com/blog/index.cfm/2008/7/9/Check-All-Checkboxes-with-JQuery ?

it's working in my IE 7.

saturngod
stil no luck with my code..
kumar