Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to ask that through textbox, we can add/store a single value. If I want to store multiple value/data in html then what I have to do.
any help would be appreciated
Posted
Comments
[no name] 25-Feb-15 4:39am    
Store in html?
Samatha Reddy G 25-Feb-15 4:45am    
am not clear with that question? can you please explain briefly?
Sunasara Imdadhusen 25-Feb-15 5:12am    
Not clear at all!

You mention 'store', if you really mean storing value on client side, then read out Beginner's Guide to HTML5 & CSS3 - Web Storage Wizardry[^]
Otherwise, if you mean to create multiple text boxes dynamically on the client side, use javascript, e.g.
XML
<!DOCTYPE html>
<html>
<body>

<table id="myTable" style="border: 1px solid black">
  <tr>
    <td>Row1 cell1</td>
    <td>Row1 cell2</td>
  </tr>
  <tr>
    <td>Row2 cell1</td>
    <td>Row2 cell2</td>
  </tr>
</table>
<br>

<button onclick="addTextbox()">Add Text Box</button>

<script>
function addTextbox() {
    var table = document.getElementById("myTable");
    var row = table.insertRow(0);
    var cell1 = row.insertCell(0);
    var cell2 = row.insertCell(1);
    cell1.innerHTML = "<input type='text'>";
    cell2.innerHTML = "NEW CELL2";
}
</script>

</body>
</html>
 
Share this answer
 
You can do this in multiple ways.

You can store them in javascript.

For example json:

var textAndOtherValues { "text" : "someText", "otherValue" : "somethingdifferent" };

When you need to acces your values you can do

MyTextbox.value = textAndOtherValues['text'];
console.log( textAndOtherValues['otherValue'];

or you can use hidden values:

Html:




greetings hope this is what you want...
 
Share this answer
 

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