It depends on the event it will invoke, but basically it will work for most input
.
Javascript
With javascript it is possible to change the value of the property value:
document.getElementById("limpar").addEventListener("click", function() {
clearInputUrlNumberText("entrada");
});
function clearInputUrlNumberText(name) {
var entradas = document.querySelectorAll("input[name='"+name+"']");
[].map.call(entradas, entrada => entrada.value = '');
}
<input name="entrada" type="url">
<input name="entrada" type="number">
<input name="entrada" type="text">
<br>
<button id="limpar">Limpar</button>
jQuery:
With jQuery it is possible using the method val:
$("button").click(function(){
$("input[data-name='entrada']").val('');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input data-name="entrada" type="url">
<input data-name="entrada" type="number">
<input data-name="entrada" type="text">
<br>
<button id="limpar">Limpar</button>
The question was unclear after remark 2 @Giancarlosolderagrazino. Could provide relevant snippets of your code and/or some example?
– BrTkCa
Try to edit your post with your js code, so we understand your problem.
– Matheus Miranda