Hi Ricardo

sorry for the late reply, was away for the weekend :-)

thanks again for the explenation and the links =)

take care and have a good week :-)

Gerald








ricardobeat wrote:
> 
> 
> You're welcome!
> 
> 'readOnly' is the DOM property, not the attribute - these are (to some
> extent) separate things. It's in the HTML4 and DOM Level 1 specs:
> 
> http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID-6043025
> http://www.w3.org/TR/1998/REC-html40-19980424/interact/forms.html#adef-readonly
> 
> cheers,
> - ricardo
> 
> On Mar 13, 5:00 am, ggerri <gerald.ressm...@ewz.ch> wrote:
>> Thanks a lot Ricardo :handshake:
>>
>> That both worked =)
>>
>> But I have to admit that I dont know why .readOnly works.:confused:
>> couldnt
>> find anything like that in the docs and thought that you always have to
>> select attributes with [..] or .attr(..) Is this an officially working
>> function?
>>
>> Thanks :-)
>> Gerald
>>
>>
>>
>> ricardobeat wrote:
>>
>> > You're returning the object you created, so that will always be true.
>> > Return the .length property and it shoud work:
>>
>> > $.extend($.expr[':'],{
>> >     readonly: function(a) {
>> >         return !!$(a).filter('[readonly="true"],
>> > [readonly=""]').length;
>> >     }
>> > });
>>
>> > But a simpler/faster/safer alternative is the DOM property 'readOnly',
>> > which seems to work fine on all major browsers:
>>
>> > $.extend($.expr[':'],{
>> >     readonly: function(a) {
>> >         return !!a.readOnly;
>> >     }
>> > });
>>
>> > You have to use !! to enforce returning a boolean value.
>>
>> > cheers,
>> > - ricardo
>> > On Mar 12, 9:30 am, ggerri <gerald.ressm...@ewz.ch> wrote:
>> >> Hi there
>> >> jQuery 1.3 has problems with handling the readonly attribute (already
>> >> filed
>> >> a ticket but I'm a bit stuck here with my project).  
>>
>> >> When you want to select  readonly inputs, you have to use
>> [readonly=""]
>> >> in
>> >> Firefox and [readonly="true"] in IE6...
>>
>> >> ( because the DOM looks like that after
>> ".attr('readonly','readonly');":
>> >>  FF: <input id="A1" type="text" value="90" readonly=""/>
>> >>  IE6: <INPUT id="A1" readOnly=True> )
>>
>> >> So I tried to extend :
>>
>> >> $.extend($.expr[':'],{ readonly: function(a) {
>> >>                                 return $(a).filter('[readonly="true"],
>> >> [readonly=""]');
>> >>                                                                      
>>    
>> >>                             }
>> >>                                               });
>>
>> >> But:
>>
>> >>  $(':text:readonly').addClass('gtest');
>>
>> >> doesnt care about the custom selector and just choses all :text
>> fields.
>> >> :,(
>>
>> >> what's wrong with my extendtion? :confused:
>>
>> >> thanks a lot guys:handshake:
>> >> Gerald
>>
>> >> ps.  $(':text').not("[readonly='true'], [readonly=''],
>> >> [readonly='readonly']") works fine in both browsers selecting all
>> input
>> >> fields which are not readonly but using a working :readonly would be
>> more
>> >> elegant right?
>>
>> >> --
>> >> View this message in
>> >>
>> context:http://www.nabble.com/whats-wrong-with-my-custom-selector-%3Areadonly...
>> >> Sent from the jQuery General Discussion mailing list archive at
>> >> Nabble.com.
>>
>> --
>> View this message in
>> context:http://www.nabble.com/whats-wrong-with-my-custom-selector-%3Areadonly...
>> Sent from the jQuery General Discussion mailing list archive at
>> Nabble.com.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/whats-wrong-with-my-custom-selector-%3Areadonly-%28IE6-sucks%29-tp22475325s27240p22534599.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to