0

I have a problem, please help

So, I'm trying to create a code that will erase any input in the search bar when an image beside the search bar is pressed. HTML: <span id="search"> <img src="Icons/white-search.png"/> </span> <input type="text" name="search" placeholder="Search"> <span id="remove-text"> <img src="Icons/delete1.png"/> </span> Javascript: $(document).ready(function (){ var input = $('input').val(); $('#remove-text').on('click', function() { $('#remove-text').remove(input); }); }); As you can see, the above code is supposed to remove input data when the remove-text id (its an image) is pressed but it doesn't work. I tried asking it on StackOverflow but people there are not very friendly and apparently its wrong to ask a javascript question so they suspended me for 3 days. Any help is appreciated

16th Aug 2017, 8:03 PM
Derek Leiro
Derek Leiro - avatar
2 Respostas
+ 10
They suspended you for three days just because you posted a Js question... ? .____. It has no sense at all, here an example without images, pure Js. https://code.sololearn.com/WCV2b7IkWM6N/?ref=app
16th Aug 2017, 7:05 PM
Maz
Maz - avatar
+ 2
@Maz The users reported it as "not correctly asked" whatever that means because I wrote it in the same way as now, how else am i supposed to ask? So they suspended me. Thanks for the help, it worked!
16th Aug 2017, 8:10 PM
Derek Leiro
Derek Leiro - avatar