+ 3
I need help
If I want to include a div element in show function in javasript,how will I do it,is it like this,function show() document.write(document.getElementById("try");
29 ответов
+ 6
Yes
+ 6
"Try" is not a tag name
+ 6
Then use :
Document.getElementById("try");
+ 6
Can u share the code ?
+ 6
Sure
+ 5
Like this ::
Document.getElementByTagName('div');
+ 2
Thanks,so will it be like this document.write(document.getElementByTagname("div")
+ 2
But it didn't work,it showed error, should I show you the whole code?
+ 2
function show(){
document.write(document.getElementByTagname("try"))
}
+ 2
This is the JavaScript code
+ 2
I created a div element in the html with the id name as try
+ 2
It also didn't work,I don't even know what to do,maybe I will just abandon the code
+ 2
The code is very simple,bt if I share it,can we work on it together
+ 2
Let me screenshot it
+ 1
Okay.in what way?
0
I ve created a div element in html with the id as try
0
Try this
function show (){
var a = document.getElementById("try").value;
document.write(a);
}
0
Thanks Yourmix Jnr
0
Yourmix Jnr,the result of the code was undefined