You'd be better off making a new "button" and copying the attributes
across. Certain browsers *cough* IE 6 *cough* don't allow you to
change the type of a "input" once it's created.

Karl Rudd

On Feb 13, 2008 10:23 PM, wwwiori <[EMAIL PROTECTED]> wrote:
>
> Dear Team,
> I have a question that how can I modify the attribute using jQuery.
> For example:
> There have a element:
>       <input id="changeType" type="checkbox" value="has changed">
> and now I would like to change the type to "button", following code is
> my tried on IE7 and Firefox 2.02 on jQuery 1.2.3 and there are not
> success:
> 1.
>      $("#changeType").attr("type","button"); //failed
>
> 2.
>      $("#changeType").removeAttr("type");
>      $("#changeType").attr("type","button"); //failed
>
> I can modify the type by following code:
>
> document.getElementById("changeType").setAttribute("type","button");
> So,How can i do this by jQuery ? Thanks in advance for your gread
> help !!
>

Reply via email to