Component transfer from one html file to another using Javascript.
Is it possible that using querySelector i get one component say a card from one html and insert it into another html page.(no click function the second page auto fetches it from the other page)
I think I can use querySelectorAll to get the component. But dont know how to insert it or if it's possible. If there is any video or you can show just a single code.
18 Replies
to what end?
what do you mean? I'm new so I dont understand the term.
it's just static html css
it's not a term, it's English 🙂
i mean, what are you trying to achieve?
Like say I've a
<div class="card"></div> on page1.html using javascript can I like fetch it and use it on the page2.htmlnot really
ok
Thank You tho.
you would have the card as a separate file
🙂
can you send me blog
or vid regarding that
if you're looking to do things like that, you should look into using a framework like Astro
which is built from the ground up to use components
ok. One more question if you dont mind.
sure
I tried using astro. but the css doesn't seem to work.
it got imported and shows up in dist folder
https://discord.com/channels/436251713830125568/1094765808170836138
probably worth asking in the astro server
oh, it won't let me link to it
ok. Thank you for the help.
Astro
Astro
Astro is an all-in-one framework for building fast websites faster. Grab content from anywhere, deploy everywhere, and show the web what you've got.
discord link top right
yeah, sorry about that, we were getting a bunch of spambots posting discord links. Currently monitoring how the new filter rule works, and how many spam links it blocks versus legitimate uses
Np, that's fair enough
Discord needs some kind of 'blue checkmark' system really