> Posted: Wed Oct 18 18:01:44 EDT 2006> From: Brandon Aaron gmail.com >> > It isn't as pretty but you could just loop through them and set the
> property manually.> > $("span.readonly input").each(function() {> this.disabled = true;> });> > I believe a fix for this is in the works, so that attr would work as
> you expected.> > --> Brandon Aaron> > On 10/18/06, Dave Methvin gmail.com> wrote:> > > $("span.readonly input").attr("disabled", "disabled");
> >> > Does this work?> >> > $("span.readonly input").attr("disabled", true);> >> > The XHTML attribute is disabled="disabled" but the _javascript_ property is
> > boolean.> >> >
These worked:
$("span.readonly input").attr("disabled", true);
$("span.readonly input").each(function() { this.disabled = true; });
But I really wanted readonly. This didn't work:
$("span.readonly input").attr("readonly", true);
But these did. Note the camelCase:
$("span.readonly input").attr("readOnly", true);
$("span.readonly input").each(function() { this.readOnly = true; });
Thanks guys.
On 10/18/06, David Avraamides <[EMAIL PROTECTED]> wrote:
I've found some inconsistent behavior in IE vs. FF and was wondering if someone might know a workaround.
I have some form fields, for which the HTML is generated by a template system out of my control. I want to set some of the fields to readonly so I wrap them in a that has a readonly class. The HTML looks like this:
Some textI have tried each of the following queries and none of them have the desired effect. Its like they aren't modifying the DOM.
$("span.readonly input").attr("readonly", "readonly"); $("span.readonly input").attr("disabled", "disabled"); $("span.readonly
input").focus(function() { $(this).blur(); });These work (with varying effects) in FF but not in IE. However if I manually put the attributes (or script) on an input field in IE it does work. I know I have the queryright because I did this
$("span.readonly input").focus(function() { alert('here'); });and I get a popup when I click on the field.Can anyone help with this?Thanks,-Dave
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/