Jacob Huggart
Jacob Huggart

Reputation: 673

ASP MVC add textboxes with jquery

I am new to jQuery, but I would like to have a button that when clicked will add more textboxes to a page. I have three textboxes that contain data of the same type and if the user has more data of the same type to enter, I would like to pop up three more textboxes.

What would be the best way to go about that?

Upvotes: 1

Views: 903

Answers (2)

Robert Koritnik
Robert Koritnik

Reputation: 105029

$("<input type='text' name='as_it_should_be'>").append(...).

Check jQuery documentation.

Regarding Asp.net MVC model binding to collections of data, this may help as well.

Upvotes: 0

Dan Diplo
Dan Diplo

Reputation: 25339

I'd recommend reading Editing a variable length list, ASP.NET MVC 2-style by Steve Sanderson. It explains how to achieve what I believe you are trying to do.

Upvotes: 1

Related Questions