On 13 Feb, 12:23, 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 !!
hi :) you could use the replaceWith() method like this $("#changeType").replaceWith('<button>has changed</button>');