Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let data = [];
- $("#textInput").change(function() {
- if ($(this).val() !== "") {
- data.push($(this).val())
- pushResult();
- }
- });
- let vali = [$("#textInput").val()]
- function pushResult() {
- $('#result').html('')
- $.each(data, function(key, value) {
- $('#result').append(`<li key="${key}">${value}</li>`);
- document.getElementById("textInput").value = "";
- });
- };
Add Comment
Please, Sign In to add comment