r/WebdevTutorials • u/Sparrow_222 • Aug 05 '22
Frontend I need help with some basic code of JavaScript.
I have to create 2 pages
First
Create an html table with 5 rows and 5 columns
Create two buttons where 1st button will add new row at bottom and 2nd button will add rows at top with data from textbox input
The first column of every row should contain serial number which is adjusted dynamically as rows are created.
Second
Create HTML page with 2 user inputs "Enter a sentence" and "Enter a letter" and a submit button
On clicking submit button it should output the rest of the sentence after the first occurance of the letter.
I've been trying to write the code but I'm a newbie to javascript and don't understand most of the stuff so if anyone can please help me with these two problems... that'd be so much helpful as i have to submit these two in my college assignment.
2
2
u/ledmetallica Aug 05 '22
This sounds like a pretty engaging exercise for a new JavaScript developer. There are easy and quick ways to do these tasks, but there are also more complex and future-thinking ways of doing it too, which would also allow your creativity to try new things as you learn more JS.
Anyway, show us what you've tried and we'll help point you towards the right direction
6
u/Magmasliver Aug 05 '22 edited Aug 05 '22
Feels like you're trying to pawn off the work to this community. Instead, if you provide what you have so far, we can give pointers on how to get closer to the solutions :)
As a quick starter, I'll breakdown where the answer to each bullet point might live:
First
HTML file -- Create an html table with 5 rows and 5 columns
HTML file -- Create two buttons
JS file -- 1st button will add new row at bottom and 2nd button will add rows at top with data from textbox input
JS file -- The first column of every row should contain serial number which is adjusted dynamically as rows are created.
Second
HTML file -- Create HTML page with 2 user inputs "Enter a sentence" and "Enter a letter" and a submit button
JS file -- On clicking submit button it should output the rest of the sentence after the first occurance of the letter.
Remember, HTML is for structure while JS is for functionality (e.g. controlling change)