Saturday, September 14, 2019
Get value from attribute with javascript
Answer
I have the following code:
echo "";
In this case, val has the value 8.
I want to access this value with javascript. I have tried the followin method, but it keeps saying that txt is null.
Anyone who can help me?
EDIT:
I solved the problem by placing the code inside window.onload:
window.onload = function() {
var txt = document.getElementById("hp");
var f = txt.getAttribute('val');
alert(f);
};
Subscribe to:
Post Comments (Atom)
hard drive - Leaving bad sectors in unformatted partition?
Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...
-
My webapp have javascript errors in ios safari private browsing: JavaScript:error undefined QUOTA_EXCEEDED_ERR:DOM Exception 22:An...
-
I would like to use the jquery autocomplete function on a field of a form collection. For example, I have a form collection that got those f...
-
I needed to resize my Boot Camp partition so I used Gparted to move and resize it. This seemed to work, except that now I can't boot int...
No comments:
Post a Comment