3 Replies - 1806 Views - Last Post: 06 September 2012 - 07:28 AM

#1 g37752  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 195
  • Joined: 24-July 12

write to hidden field, but not hidden?

Posted 04 September 2012 - 06:56 PM

How come it's not hidden when I write to a hidden element?

document.getElementById("myid").innerHTML=str;


<td colspan=6><span id="myid" type="hidden"></span></td>


the string str shows up, not hidden?
Is This A Good Question/Topic? 0
  • +

Replies To: write to hidden field, but not hidden?

#2 fromTheSprawl  Icon User is offline

  • Monomania
  • member icon

Reputation: 513
  • View blog
  • Posts: 2,056
  • Joined: 28-December 10

Re: write to hidden field, but not hidden?

Posted 04 September 2012 - 07:26 PM

Why is it type = hidden?
To make something hidden use the property visibility or display. What do you plan to achieve anyway?
Was This Post Helpful? 1
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3491
  • View blog
  • Posts: 10,064
  • Joined: 08-June 10

Re: write to hidden field, but not hidden?

Posted 05 September 2012 - 06:46 AM

<span>s do not have a type attribute, that’s for <input> elements (and some others).
Was This Post Helpful? 0
  • +
  • -

#4 JMRKER  Icon User is offline

  • D.I.C Addict

Reputation: 128
  • View blog
  • Posts: 826
  • Joined: 25-October 08

Re: write to hidden field, but not hidden?

Posted 06 September 2012 - 07:28 AM

Here is an example of the difference ...
<!DOCTYPE HTML>
<html>
<head>
<title> Untitled </title>
<script type="text/javascript">


</script>

</head>
<body>
<input type="hidden" id="hiddenID" value="This is a hidden value">
<button onclick="alert(document.getElementById('hiddenID').value)">Hidden value</button><p>
It's a<span
 onmouseover="document.getElementById('spanMad').style.display='inline'"
 onmouseout="document.getElementById('spanMad').style.display='none'">
 <u>mad</u></span><span id="spanMad" style="display:none">, mad, mad, mad</span> world!
</body>
</html>


:bananaman:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1