I am doing an .NET MVC project, there i am running a for loop to create n number of textboxes and checkboxes, I want to fill data in textbox when corresponding checkbox is checked. Since all the textboxes and the checkboxes have same ID and Name, I am facing problem.
foreach (var item in Model)
{
<input type="checkbox" name="BooksToCart" id="BooksToCart" value="@item.BookId">
<input type="number" name="NoBooksToCart" id="NoBooksToCart">
}
I would also like the javascript code. Thanks!