0
Use GetElementByID on two page html
I would create a new page taken some elements from another page, as I am a newbie I am look for on the web some help to use getelementbyId between this two page, but maybe this is the wrong way.
15 Antworten
+ 3
getElementById() is used to embed some js onto a html elemement after firing an action on that element. Take for example a button, you can assign it an id attribute then specify what should happen when its either clicked or an action is executed in the document eg:
<button id="btn">Click me</button>
Now in js:
function functionName() {
alert("Hello");
}
Let btn= document.getElementById("btn");
btn.addEventListener(click, functionName());
We just added a simple js code that alerts Hello when the button is clicked. The getElementById() was just used to help embed code to the particular button and not any other, because remember, id attribs are always unique.
Happy coding 😉 Keep coding 💪
+ 3
Use the DOM model in creating the second page since variables used in page one will be applied in page two
+ 2
I imagined that this mod was not suitable.
What can I use to build one page with elements of another?
+ 2
None so far but code mode is not what you want because all the elements are launched in the same page....its just the elements getting handled using the pseudo classes in js
+ 2
...but it moremor less carries the same concept
+ 2
Ill work on that then
+ 2
https://code.sololearn.com/W80l0huYVkI5/?ref=app
But you should learn Node.js instead
https://medium.com/@neetishop/best-learning-path-to-master-nodejs-97d25d53b763
+ 2
Gordon nodejs does not apply in fronend does it?
+ 1
Be abit clearer
+ 1
I have a dynamic page (page1) that do some calculations then I would like to create another summary page that retrieves some data from page1
+ 1
Have you some example, so i can see better? Some like your code “Mood”?
+ 1
Ok, I really need some example to understand better
+ 1
Node.js works in backend, and that's how to "get element of first page for using in second page"
+ 1
Ok got u
0
Thanks Gordon!