<td class="line-number" value="1772"></td> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

<td class="line-number" value="1772"></td>

please my question solve please <td class="line-number" value="1772"></td>

30th May 2021, 1:13 PM
jai baba di jai baba di
jai baba di jai baba di - avatar
3 Answers
+ 2
jai baba di jai baba di what is your question ?
30th May 2021, 1:15 PM
TOLUENE
TOLUENE - avatar
0
what's your question
30th May 2021, 1:16 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
only input/form fields element have a value attribute... to store user defined attribute you must use data-* attributes to be valid html: <td class="line-number" data-value="1772"></td> doing so, you can access the value stored in your user defined attribute through JS by using the .dataset object property: onload = () => { let ln_num = document.querySelectorAll(".line-number"); for (let ln of ln_num) { ln.onclick = handleLineClick; } function handleLineClick() { console.log("line number",this.dataset.value,"was clicked"); } }; https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-* https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/dataset
30th May 2021, 5:50 PM
visph
visph - avatar