MeetCode
Home
Doubts
Why is my C function not returning the …
Solved
1
49
Ask Doubt
View All Doubts
Solvers Leaderboard
Tutorials
Quiz
All Tests
Leaderboard
My Tasks
User Login
Dark
Enable Notifications
Toggle navigation
Read Data Attribute and Show It
JavaScript
Easy
2 views
Back to Questions
View Answer
0
Previous
Run Click Handler Only Once
Easy
P
Next
Dynamic List Delete (Event Delegation)
Medium
N
Problem Description
You have
and
. On page load, read data-id and show it inside #out.
Input Format
No input.
Output Format
No output (DOM change).
Constraints
Assume #card has data-id and #out exists.
Official Solution
const card=document.getElementById('card');const out=document.getElementById('out');out.textContent=card.dataset.id||'';
Please
login
to submit solutions and comments.
Solutions (0)
No solutions submitted yet. Be the first!
Discussion (0)
No comments yet. Start the discussion!
Prev
Next
Fullscreen Editor
0 lines • 0 chars
Esc close • Tab indent
No comments yet. Start the discussion!