jQuery: Change element type from hidden to input

By : Tom
Source: Stackoverflow.com

I've got an input which it's type is set to hidden, I need to change it's type to text. Can't seem to figure this out or if it's possible with jQuery

By : Tom


easy man...

$('input[type="hidden"]').each (function() { this.type = 'text'; });          

Trigger it on a event

By : ab.

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);

Old thread, but I recently needed to do something similar but with file fields and clearing them... I think the same solution could apply, but at least you can grab the contents in this case.

var temp = $('#hidden-field').val();
$("#container-for-field").html("<input id='not-hidden' type='text' value='"+temp+"'/>");

That should also solve the problem :).

By : Parris

This video can help you solving your question :)
By: admin