What is the simplest way to dynamically create a hidden input form field using jquery?
+5
A:
$('#myformelement').append('<input type="hidden" name="myfieldname" value="myvalue" />');
Mark B
2010-03-09 09:56:57
+6
A:
$('<input>').attr('type','hidden').appendTo('form');
To answer your second question:
$('<input>').attr({
type: 'hidden',
id: 'foo',
name: 'bar'
}).appendTo('form');
David
2010-03-09 10:02:37
Is it possible to add id and name attributes on the fly???????
Mithun P
2010-03-09 10:07:26
thank you David
Mithun P
2010-03-09 11:32:00