| Author |
How to access content of p tag
|
nirjari patel
Ranch Hand
Joined: Apr 23, 2009
Posts: 239
|
|
I am trying to access content of tag with id hours and mins. But it is not working. Please let me know, how to access content of p tag
I have tried following also, but I am not getting value from javascript.
I have tried following code, but gethrs() does not trigger with onload event. why
Thanks
|
 |
Swastik Dey
Ranch Hand
Joined: Jan 08, 2009
Posts: 1196
|
|
try this
|
Swastik
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Only input elements have values and .text does not exist.
Eric
|
 |
nirjari patel
Ranch Hand
Joined: Apr 23, 2009
Posts: 239
|
|
When I am using this code, still its not working. WHen I add "document.getElementById("hours").innerHTML = dtObj.getHours();" , code stops working. If this line is not added in javascript, all alerts upto 4 are working. So there is something wrong with this code, which stops everything. What can be wrong with this ?
Whats the difference between two codes ? Bottom one is working, top one is not. I wouldlike to know the bug, this thing keeps happening.
Thanks
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Surely there must be something in the Javascript console if your Javascript code ends unexpectedly?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56201
|
|
Not always. De-referencing an undefined values often results in a silent failure. It's sometimes infuriating.
So, what has been done to verify that the items that are being dereferenced are not undefined?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
nirjari patel
Ranch Hand
Joined: Apr 23, 2009
Posts: 239
|
|
I have re-written the code in a new file and its working.
Now this is my question. Where shall I start from for such a bug ? Now in this case, as you mentioned " what has been done to verify that the items that are being dereferenced are not undefined? " How can I verify this ?
Thanks
|
 |
 |
|
|
subject: How to access content of p tag
|
|
|