The moose likes HTML, CSS and JavaScript and the fly likes JavaScript to get and update the 'value' of a text field? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "JavaScript to get and update the Watch "JavaScript to get and update the New topic
Author

JavaScript to get and update the 'value' of a text field?

Toni Howlett
Greenhorn

Joined: Jan 18, 2012
Posts: 25


I plan to have multiple instances of the code above, and next to each, a button that says up, and another that says down. My goal is to have it when these are clicked, it will change the order in an array I have, but I need the value of the textfield to change as well so the user knows what order they are in.

With that said, all I need to know is that is there a simple way to get it and change it?
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50691

Give the element an id, then:
You can get the reference other ways, but getting it by id is the least fragile and surest way.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Toni Howlett
Greenhorn

Joined: Jan 18, 2012
Posts: 25
Awesome, thanks!
Simple and just what I needed.
 
 
subject: JavaScript to get and update the 'value' of a text field?
 
Threads others viewed
textarea and conditional READONLY
JS code not working.
JavaScript code works in firefox but not in IE8
Setting currency problem.
Making a input text field readonly..
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture