+ 1
See and please tell where am i wrong?
<!DOCTYPE html> <html> <head> <title>Page Title</title> </head><div id="demo "style="width:200px"> some text </div> <script> var x=document.getElementById("demo"); x.style.width="500px"; </script> </html>
4 Respostas
+ 5
Try this one
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<div id="demo"width="200px"> some text </div>
<script>
var x=document.getElementById("demo");
x.style.width="500px";
</script>
</html>
+ 5
Rinku Das The reason the code failed was because you had an extra space character after demo in your div id. Id="demo "
You are also missing the <body></body> tag although that won't cause it not to work.
0
Ok