How to get <td> value in textbox
Posted
by
Shreeuday Kasat
on Stack Overflow
See other posts from Stack Overflow
or by Shreeuday Kasat
Published on 2012-11-06T16:56:03Z
Indexed on
2012/11/06
17:00 UTC
Read the original article
Hit count: 149
JavaScript
|jQuery
I've done some code in html and in JavaScript ... My query is when I click on <td>
, whatever the value associated with it, has to be displayed in the corresponding text box ...
In front of <td>
I've taken the textbox ... for an example I've taken 3 <td>
and 3 textboxes
<script type="text/javascript">
function click3(x) {
x = document.getElementById("name").innerHTML
var a = document.getElementById("txt");
a.value = x;
}
function click1(y) {
y = document.getElementById("addr").innerHTML
var b = document.getElementById("txt1");
b.value = y;
}
function click2(z) {
z = document.getElementById("email").innerHTML
var c = document.getElementById("txt2");
c.value = z;
}
</script>
this is my JavaScript code , I know this is not an adequate way to deal such problem, since its giving static way to deal with this problem does anyone have a better solution for this problem ?? In JavaScript/jQuery
© Stack Overflow or respective owner