One Changing JavaScript Variable Being Displayed (and updated) in Multiple
Locations in HTML
I have some javascript that is returning the word count of a text field
into a 'wordcount' var.
I'd like for the 'wordcount' var (and other variables based on it) to be
displayed throughout my HTML. But in a way where they can be constantly
updated as the word count changes.
e.g. Your current wordcount is 10. You have 5 remaining words. The current
cost is £10 (£1 / Word).
I'm relatively new to the wonders of JavaScript, but I've picked up the
following from what I've read online...
document.write is frowned upon.
getelementsbyid will only allow me to display each variable once.
jQuery has a .data functionality that stores (and updates?) data locally?
Can anyone please point me in the right direction?
Thanks, Andy.
No comments:
Post a Comment