将输入标记值传递给href参数

Ale*_*lex 4 html javascript

我想将输入标记的值作为参数(quantita)传递给href.我应该用javascript来做这件事吗?抱歉,我的英文谢谢

<input type="text" id="qta_field" value="${item.value}"/><a href="updateItem?codice=${item.key.codice}&quantita=">update</a>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Sim*_*cha 9

使用链接并且没有任何库的最简单方法:

<input type="text" id="qta_field" value="${item.value}"/>
<a href='' onclick="this.href='updateItem?codice=${item.key.codice}&quantita='+document.getElementById('qta_field').value">update</a>
Run Code Online (Sandbox Code Playgroud)