Solved

How do I make this onchange thing work?

Posted on 2014-02-26
3
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 11

Accepted Solution

by:
John Easton 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

695 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