+ 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
7 Réponses
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