Abhilash J A

Abhilash J A

  • NA
  • 2.4k
  • 581.9k

Get innerHTML value from dynamically generated textbox MVC5

Jan 20 2017 4:01 AM
Hello everyone,
 
 I am creating a dynamic table with textbox and multiple images by input type file.
  1. function handleFileSelect(e) {   
  2. selDiv = document.querySelector("#dvPreview");  
  3.   
  4.   for (var i = 0; i < fileList.length; i++) {  
  5.         selDiv.innerHTML += "<tr><td><img src=" + objectUrl + " /></td><td><input id='txtImgdescription' type='text'/></td><td><input class='check_class' type='checkbox'/>   <a onclick='delete_user($(this))'> X </a></td></tr>";  

I want image description from textbox with respect to corresponding image. So I have done, after bind the table on .cshtml page there is model class, the I can not the value from view to controller.
 
I did tried write textbox like model=>model.Imgdescription
  1. <input id='txtImgdescription' type='text'/> 
 instead of
  1. <td>@Html.TextAreaFor(model=>model.Imgdescription)</td>   
 but nothing happened. Then view look like this,
 
 
 Please help me...

Answers (1)