Solved

How do I make this onchange thing work?

Posted on 2014-02-26
3
159 Views
Last Modified: 2014-02-26
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
Comment
Question by:brucegust
3 Comments
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 200 total points
ID: 39889516
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
 
LVL 10

Accepted Solution

by:
JEaston earned 300 total points
ID: 39889537
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
 

Author Closing Comment

by:brucegust
ID: 39889859
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question