简体   繁体   English

在表单页面上显示输入值而不单击提交

[英]displaying value of an input on the form page without clicking submit

I'm creating a form .我正在创建一个form How can I make the value of an input display on the form page without clicking the submit button using php and maybe JavaScript如何在不使用 php 和 JavaScript 的情况下单击提交按钮的情况下在表单页面上显示input的值

Add an input event listener to the field and output it where needed.将输入事件侦听器添加到字段并在需要的地方输出。

 const input = document.querySelector("#in"); const output = document.querySelector("#out"); input.addEventListener("input", (e) => { output.textContent = e.target.value; });
 <p>Type text here: <input id="in" /></p> <p>See result here: <span id="out"></span></p>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用javascript在没有提交按钮的情况下显示输入值到另一个页面 - Displaying input value without a submit button to another page using javascript 在不使用 PHP 的情况下单击表单中的提交(输入类型)后,如何使用 javascript 在页面上显示消息 - How to display a message on page using javascript after clicking on submit(input type) in a form without using PHP 提交表格而不点击提交 - Submit a Form without Clicking Submit 使用Ajax在页面加载时提交表单输入值 - Submit form input value on page load with ajax 如何在 Laravel 8 中使用输入的值在同一页面上呈现特定内容而无需页面刷新或表单提交 - How to use the value of an input to render specific content on the same page without a page refresh or a form submit in Laravel 8 通过提交获取表单的价值而无需刷新页面 - get value of form with submit without refreshing the page 如何在不单击提交按钮的情况下提交表单? - How to submit a form WITHOUT clicking a submit button? 单击按钮将在输入字段中放置一个值,而不重新加载页面 - Clicking a button will put a value at input field without reloading the page 单击表单按钮不带 <input> ? - Clicking on form button without an <input>? 在不提交表单或输入ReactJ的情况下获取期权的价值 - Get value of option without submit form or input ReactJs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM