[Solved] JavaScript code doesn’t work [duplicate]


searchInput=searchValue.value;

That will get the .value property of the <input> when it is executed, instead of creating a pointer to it. The variable searchInput will just contain the empty string, and that won’t change.

Move that assignment into the event handler to retrieve the value when the button is clicked, and it will work.

(working demo at jsfiddle.net, also fixed the syntax error mentioned by @KevinBowersox)

solved JavaScript code doesn’t work [duplicate]