Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** append an hidden input to a form */
- function dynamicAddElementToForm( htmlForm, key, value )
- {
- var obj = $("[name='"+ key +"']");
- if( obj.length ){
- obj.val(value);
- }else {
- var inputHiddenTemp = document.createElement('input');
- inputHiddenTemp.type = 'hidden';
- inputHiddenTemp.name = key;
- inputHiddenTemp.value = value;
- htmlForm.appendChild( inputHiddenTemp );
- }
- }
- /** use example */
- var htmlForm = document.forms[IR_LocalNomeForm];
- dynamicAddElementToForm(htmlForm, "unParametroX", "true" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement