javascript - Using JS to auto append new rows based off input selection -
i looking add functionality similar expedia , hotels.com , other similar sites when select number of rooms give option how many adults , children per room. if choose children allow select ages per child well. please see image below example. willing use handlebars or mustache.
for working example visit example.
the first image shows before selecting multiple rooms or children.
what should
- create template room
- create template children ages.
then after number of rooms selected render many room templates number of rooms.
then repeat same process ages of children.
the piece of data need careful attribute name or id of each of inputs inserted templates because needs match way backend deserialize form.
some frameworks .net mvc have conventions if going post array of objects "name" attribute has like
name = "[x].adults"
let me know if need code sample further explain said above if follow steps mentioned should able develop form quickly.
---- new ----
find below link simple example of explaining above. keep in mind mockup similar need do:
Comments
Post a Comment