473,394 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

set text input value onclick etc

Hi,

Its something stupidly simple but for some reason i cant find a straight forward cross browser solution.

I've got 2 sets of address fields and i want a tick box that when the user clicks it populates the 2nd lot of boxes with the values in the first.

I had it working in I.E ok using the following;

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("inputid2").value=document.getElementById("inputid1").value;
But it doesn't seem to be working in chrome.....im guessing it must need referencing in a different way.

Does anyone have a straight forward cross browser method for setting various input values.

Thanks
Jan 5 '11 #1
4 2869
Dormilich
8,658 Expert Mod 8TB
do the input fields actually have an id?
Jan 5 '11 #2
I've actually just checked again and its not working at all(any browser)....the input definitely has an id set.

even this document.getElementById("fnameb").value="test";
doesnt work....fnameb is the id.

any reason why that wouldnt work?
Jan 5 '11 #3
Dormilich
8,658 Expert Mod 8TB
I would need to see the page to make a qualified judgement.
Jan 5 '11 #4
Samishii23
246 100+
If you have Chrome go to the little Wrench icon in the upper-right (Below the minimize / max / close buttons), then go to Tools, then Javascript Console. It'll give you error messages there, and if it helps you great, if not it could help us help you.

Oh and posting your exact code would help too, or link.
Jan 6 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: JeffFinnan | last post by:
Is there a way to have a text input field equal some variable value so that it changes if that variable changes? It does not have to by dynamic. <INPUT TYPE="TEXT" NAME="hW" size="4" value=some...
1
by: Scott Navarre | last post by:
Hello, I have noticed that when using JavaScript to create a page, the sizes of the text input form elements come out bigger than the size I am trying to set them to. I don't know if it...
5
by: Art | last post by:
Hi, I'm using a form text input to display a JavaScript clock. It has no other purpose than that, just show the date and time. What I would like to do now is prevent anything else happening when...
2
by: Offm | last post by:
I was trying to make some experiences with javascript , making a div response to a text input but cannot say what am doing bad so if anyone could help with the script, many Thanks the script...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
3
by: Todor Vachkov | last post by:
Dear all, here is the code: ----------------------------- <tr>         <td>ohne Anmeldung: </td>         <td><input name="vanm" id="vanm" type="checkbox"...
2
by: troberts | last post by:
Hi What I'm trying to achieve is a watermark on a search box (text input). I've got it working fine (it displays an image, onfocus it shows no image) but when the user writes something then clicks...
4
by: Andrew Poulos | last post by:
I have a form that looks something like the following: <form"> <div id="pg0"> <!-- more HTML here --> <input type="text" name="f0_0" > </div> <div id="pg1" style="display:none;"> <!-- more...
4
by: Aaron Gray | last post by:
The following input checkbox onclick via DOM is not working on IE7, FF, or WebKit, but is working on Opera for some strange reason. http://www.aarongray.org/Test/JavaScript/checkbox.html ...
0
by: pazazuzu | last post by:
Hi everyone, I currently have an assignment which I am almost done with but am having problems trying to figure out how to integrate a string function search. I have a text box called...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.