Hello World! I have a question about making custom tags... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hello World! I have a question about making custom tags...

โ€ข I wanna my new custom tags, and I wanna make the Javascript can read the text inside my tag, example, like <alert>Hello World</alert>... I wanna make it an alert saying "Hello World" or any word that I will put inside the tag... โ€ข I wanna make the Javascript can read the attributes inside my tag... Is it possible? Any help will be appreciated!๐Ÿ˜Š I'm currently thinking of making a <print></print> tag and any printing tags shouldn't work, just only <print></print> tag, I'm the one who is responsible for making that printing tags shouldn't work, just help me!๐Ÿ˜Š

18th Feb 2021, 1:30 PM
trash
6 Answers
18th Feb 2021, 3:45 PM
Nor'wester ๐ŸŒช๏ธ ๐Ÿ‡ง๐Ÿ‡ฉ (INACTIVE)
Nor'wester ๐ŸŒช๏ธ ๐Ÿ‡ง๐Ÿ‡ฉ (INACTIVE) - avatar
+ 3
Hey there ๅคงๅฅฝใ , I know that I'm a bit late, but I found a solution too. https://code.sololearn.com/W1fh5c1UvHia/?ref=app Hope it can be helpful :)
22nd Feb 2021, 6:34 AM
Matthew
Matthew - avatar
+ 2
Reading custom elements' content or attribute is one thing. But to make them spawn a JS alert box is something else. If you want, you can use JS to map a certain event (e.g. click event) on those <alert> elements to trigger the alert box. But if you mean to have the browser displays a JS alert box on finding the <alert> element while processing the document, I have no idea.
18th Feb 2021, 2:08 PM
Ipang
+ 2
Ipang Oh, thank you for the information!๐Ÿ˜Š Mirielle Yeah, that's what I mean๐Ÿ˜ต๐Ÿ˜Š ๐Ÿ‡ง๐Ÿ‡ฉ๐Ÿ‡ณโ€Œ๐Ÿ‡ดโ€Œ๐Ÿ‡ทโ€Œ'๐Ÿ‡ผโ€Œ๐Ÿ‡ชโ€Œ๐Ÿ‡ธโ€Œ๐Ÿ‡นโ€Œ๐Ÿ‡ชโ€Œ๐Ÿ‡ทโ€Œ Oh hey, thank you for the example! How do you get the letters inside the tag?๐Ÿ˜Š Well, I should inspect this!๐Ÿ˜ต
19th Feb 2021, 7:55 AM
trash
25th Feb 2021, 12:59 PM
Calviีฒ
Calviีฒ - avatar
+ 1
https://code.sololearn.com/WMQA8yiYK8so/?ref=app
25th Feb 2021, 1:19 PM
Calviีฒ
Calviีฒ - avatar