With twitter bootstrap it is quite straight forward to create a Search style input widget:
Also the x is doable with Twitter bootstrap, but positioning the x in that spot, requires some CSS finetuning.
I managed to get the x in that position, but it isn't very reliable. With a responsive-design and different resolutions the x gets completely displaced.
.filter-close {
float: none;
position: relative;
left: 5em;
top: 1.25em;
z-index: 3;
}
<form action="." method="get" class="form-search">
<a class="close filter-close" href="#">x</a>
<div class="input-append">
{{filter_form.last_name}}<button type="submit" class="btn"><i class='icon-filter'> </i></button> </div>
</form>
Before trying to reinvent the wheel, is there any existing javascript library that could turn an input in an input-with-an-x-button? Something like Chosen.js for this purpose? Or any advice how I could do this in a better way?
Many Thanks,
To clear an input field after submitting:When the button is clicked, set the input field's value to an empty string. Setting the field's value to an empty string resets the input.
The <input type="text"> defines a single-line text field. The default width of the text field is 20 characters.
Check out this post
This fiddle basically does what you are looking to do.
You are headed in the right direction.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With