javascript - Change value of a form stored in a variable -
how change value of input field of form never printed html of page? (i don't want add html of page)
i'm not sure if have use $form notation vs. form
i'd change value of myname input field before submitting form.
var $form = $('<form/>', { method: 'post', id: 'form1', name: 'form1', action: 'example.example' }); $form.append($('<input/>', {name: 'myname', value: 'myvalue', type: 'hidden'})); $form.submit()
you should assign new input variable, , use variable change value:
var $form = $('<form/>', { method: 'post', id: 'form1', name: 'form1', action: 'example.example' }); var inp = $('<input/>', {name: 'myname', value: 'myvalue', type: 'hidden'}); $form.append(inp); $(inp).val('something else'); $form.submit()
Comments
Post a Comment