• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

How do I make this onchange thing work?

My user is given an input field like this:

<input type="text" size="35" name="allocatedmonies" id="allocated_1" onchange="visibility()">

To the immediate right of that field, I want to place a small icon that the user can click on and save the record. I'm thinking that would look something like this:

<div id="save_1" visibility="false"><img src="icon.jpg"></div>

I'm shooting in the dark here, guys, so I'm just giving you scaffolding.

What would be the JavaScript function that would make "save_1's" visibility to be "true" so it would be seen the moment my user alters the data in the "allocatedmonies" field?

What do you think?
0
brucegust
Asked:
brucegust
2 Solutions
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
if you're using pure javascript, then you would do:

<input type="text" size="35" name="allocatedmonies" id="allocated_1" onchange="document.getElementById(;save_1;).style = 'block';">

of course, you could put the same line in a function called visibility() and just call the function if you want
0
 
John EastonDirectorCommented:
Similar answer to Big Monty using a seperate function:

<script>
function visibility() {
	document.getElementById('save_1').style.visibility = 'visible';
}
</script>
<input type="text" size="35" name="allocatedmonies" id="allocated_1" onchange="visibility()">
<div id="save_1" style="visibility:hidden"><img src="icon.jpg"></div>

Open in new window

0
 
brucegustAuthor Commented:
Thanks guys! I have the next challenge / question at http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28375375.html, would love it if either one of you would weigh in.

Thanks!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now