File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -27,18 +27,17 @@ const checkBox = document.querySelector(".check");
2727//check the right input from forms and if its ok -> add the new book (object in array)
2828//via Book function and start render function
2929export function submit ( ) {
30- const bookTitle = titleElem . value . toString ( ) . trim ( ) ;
31- const bookAuthor = authorElem . value . toString ( ) . trim ( ) ;
30+ const bookTitle = titleElem . value . trim ( ) ;
31+ const bookAuthor = authorElem . value . trim ( ) ;
3232 const bookPages = Number ( pagesElem . value ) ;
3333
34- if ( ! Number . isInteger ( Number ( pagesElem . value ) ) ) {
34+ if ( ! Number . isInteger ( bookPages ) ) {
3535 alert ( "Pages must be an integer !" ) ;
3636 return false ;
3737 }
3838 else if (
3939 bookTitle == "" ||
4040 bookAuthor == "" ||
41- bookPages == "" ||
4241 bookPages <= 0
4342 ) {
4443 alert ( "Please fill all fields!" ) ;
You can’t perform that action at this time.
0 commit comments