html - Is it possible to overwrite the action-value in a form? -
is possible overwrite action-value of 1 searchfield when submitting value of second searchfield? i'm in need of adding searchfield
<input type="search" id="id2"> <input type="submit" value="value2" />
to: <form method="get" action="/../.." id="search"> <div> <input type="search" id="id1"> <input type="submit" value="value1" /> </div> </form>
by pressing enter in second searchfield, i'm forwarded link of first searchfield because has action-value.
can change behaviour?
using javascript :
function setaction(){ document.getelementbyid('search').setattribute('action',document.getelementbyid('id2').value }
you need set onclick event of 'id2' setaction().
Comments
Post a Comment