I didn't know that, but I do have a related question if you don't
mind.

I prefer to use...
$('<input type="button" id="some-id" value="yes">');
...instead of...
$('<input type="button">').attr({'id':'some-id', 'value': 'yes'});

It works fine, but so many people choose to use the second method.
Is there anything wrong with the way I do it?

On Apr 12, 10:30 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
> Some of the attributes of a DOM object in IE are read-only.
>
> The "type" attribute is one of these and so cannot be assigned to AFTER the
> element is created.
>
> JK
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
>
> Behalf Of spinnach
> Sent: Thursday, April 12, 2007 2:06 PM
> To: [EMAIL PROTECTED]
> Subject: [jQuery] dynamic creation of an button
>
> anybody knows why the following fails in ie, but works ok in firefox?
> $('<input>').attr({'type': 'button', 'id':'some-id', 'value': 'yes'})
>
> when i remove the type hash attribute, it works:
> $('<input type="button">').attr({'id':'some-id', 'value': 'yes'});
>
> dennis.

Reply via email to