How can I make this work?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I make this work??

<script type ="text/template" id = "player-list-template"> $(document).ready(function(){ $("#YOURTEXTBOXID").keypress(function(event){ var inputValue = event.which; if(!(inputValue >= 65 && inputValue <= 120) && (inputValue != 32 && inputValue != 0)) { event.preventDefault(); } }); }); <input id ="text-player" type="text" placeholder="add a person.." > <ul id ="player-list"> </ul> </script>

3rd Mar 2018, 2:47 AM
Dondon Bragais
Dondon Bragais - avatar
2 Answers
+ 2
Dondon, it would better if you save this as a code and post the code link here instead of posting the code as plain text. That way we can easily see the problem. Based on what you posted, what do you want to happen when the user presses the keyboard? Also, you shouldn't put html markup inside the script tag. You will get errors.
3rd Mar 2018, 3:18 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
0
@Jonathan Sorry I'm new here, I dont know how to link the code here. I'm trying to restrict the user from entering a numerical character. Only letters and spaces can be entered. Okay I'll put the html tags outside. Thanks. I'm just freaking out cause my deadline is getting near
3rd Mar 2018, 3:40 AM
Dondon Bragais
Dondon Bragais - avatar