I'm trying to clear the values in a text field upon clicking on a cross button inside it.
HTML MARKUP
<input type="text"
placeholder="I want to go..."
class="nom-fields"
value="{{Session::get('place')}}"
name="place-city"
id="geocomplete">
<input type="reset"
id="clear-input-close"
class="clear-input-close"
value=""
onclick="JavaScript:eraseText();">
JAVASCRIPT
function eraseText() {
document.getElementById('geocomplete').value = '';
}
If works fine if the Session::get('place')
is empty. But if it has some value, the textfiled is getting cleared and restores the value immediately. How can I clear the value just in the textfield?