Click here to Skip to main content
14,984,032 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have html table, value are added to the table at run time,
I want to edit the value in row, if click the row its change to textbox, I need solutions?
Posted
Updated 5-Dec-17 1:12am
v2

Hi,

You can do that using jQuery very easily,

Here[^] you can find solution.

Sample Code,
JavaScript
$("#table_ID td:contains('youSearchText')").html('YourTextToReplace');


Let me know if you have any other query,

Thanks
-Amit Gajjar
   
v4
Comments
Skvignesh 14-Aug-12 4:23am
   
i ve to do it in javascript ly, that's y i'm asking...
AmitGajjar 14-Aug-12 4:27am
   
jQuery is javascript API. and it's MIT license so you can use it.
AmitGajjar 14-Aug-12 4:29am
   
Please check my updated answer.
How about this pure javascript
HTML
<html>
<head>
	<script type="text/javascript">
		function Change() {
			var txt = parseInt(document.getElementById("txt").value)
			alert(txt);
			var tr = document.getElementById("tbl").getElementsByTagName("tr")
			tr[txt].getElementsByTagName("td")[0].innerHTML = "change me"
		}
	</script>
</head>
	<body>
		<table id="tbl">
			<tr><td>1</td></tr>
			<tr><td>2</td></tr>
			<tr><td>3</td></tr>
		</table>
		<input type="text" id="txt"/>
		<input type="button" id="btn" value="Change" onclick="Change();"/>
	</body>
</html>
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900