File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1313 <form id =" search-form" action =" " method =" get" action =" #" >
1414 <div class =" input-group" >
1515 <input type =" text" class =" form-control" autofocus =" autofocus" id =" username" name =" username" placeholder =" Github username"
16- required>
17- <button type =" submit" class =" input-group-addon btn" name =" " onClick =" showLoader ();" >
16+ required title = " Username cannot be empty or contain only spaces " >
17+ <button type =" submit" class =" input-group-addon btn" name =" " onClick =" return validateInput ();" >
1818 <i class =" fa fa-search" ></i >
1919 </button >
2020 </div >
103103<script src =" public/js/spinner.js" ></script >
104104<div id =" fb-root" ></div >
105105<script src =" public/js/social.js" ></script >
106+
107+ <script >
108+ function validateInput () {
109+ const inputField = document .getElementById (" username" );
110+ if (/ \s / .test (inputField .value )) {
111+ alert (" Username cannot contain any spaces." );
112+ return false ;
113+ }
114+ showLoader ();
115+ return true ;
116+ }
117+ </script >
You can’t perform that action at this time.
0 commit comments