jQuery: Change element type from hidden to input

With jQuery 1.4 you can change the type of an input while it’s detached.

marker = $('<span />').insertBefore('#myInput');
$('#myInput').detach().attr('type', 'text').insertAfter(marker);
marker.remove();

Leave a Comment