• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

How to access content of p tag

 
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only input elements have values and .text does not exist.

Eric
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Marshal
Posts: 27450
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Surely there must be something in the Javascript console if your Javascript code ends unexpectedly?
 
Sheriff
Posts: 67682
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic