How to disable the sending of an empty form field?

Hello.

Example form:
<form action="form.php" method="GET">
 <input type="text" name="city" value>
 <input type="text" name="price" value="300">
<button>Send</button>
</form>


When sending thrown at: http://site.ru/form.php?city=&price=300
So you need: http://site.ru/form.php?price=300

How can I exclude the empty box?
July 4th 19 at 23:16
4 answers
July 4th 19 at 23:18
Solution
So

$(document).on('submit', '.js-form-search', function(){
 var area = $('select[name=area]');
 if (!area.val()) {
 area.prop('disabled', true);
}
});
July 4th 19 at 23:20
The attribute required
It's not something - Baylee43 commented on July 4th 19 at 23:23
July 4th 19 at 23:22
Filter data in JS form the GET-line and be redirected to her user.
July 4th 19 at 23:24
You pointed out the JS and jQuery tags, show the code that you are processing this form. We will tell you what to change.
There are no treatments usual. - Baylee43 commented on July 4th 19 at 23:27

Find more questions by tags HTMLJavaScriptjQuery