469,948 Members | 2,889 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,948 developers. It's quick & easy.

How to Lookup input value based on ID?

Hello,

I am requiring some assistance in creating a function that will be able to look up and return a value based on an ID using javascript.

I am having a user click a checkbox and the checkbox takes this structure:

Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" value="<?= $statistic_id; ?>" name="<?= $statistic_id; ?>"  id="checkbox_data" <?= $i==0 ? 'checked="checked"' : null; ?> />
  2. <label for="checkbox_<?= $statistic_id; ?>"><?= getStatisticFromId ( $statistic_id ); ?></label>
  3.  
There are about 20 different checkboxes and the value $statistic_id varies from a value of 1 to 20.

I would like to select the checkbox based on the ID, then find its value, then return its value. How is this possible?

I would really appreciate any sort of assistance you can provide. Thank you!
Oct 21 '10 #1

✓ answered by BaseballGraphs

It appears that by performing this function you can return the appropriate value
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('checkbox_data').value;
  2.  

1 1579
It appears that by performing this function you can return the appropriate value
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('checkbox_data').value;
  2.  
Oct 21 '10 #2

Post your reply

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

Similar topics

2 posts views Thread by lehmann | last post: by
2 posts views Thread by Jeff | last post: by
2 posts views Thread by whojustdenyme | last post: by
2 posts views Thread by Chris Riesbeck | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.