Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Dynamically assign Id to inputs

$
0
0

Hello 

I am creating Dynamic input, using For loop, the number of created input varies. 

I need to assign an Id to each created input with prefix 

for example, name input will be name1, name2 

email input email1 email2 ......

for (int i = 0; i < value ; i++)
{<div class="item form-group"><label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Name <span class="required">*</span></label><div class="col-md-6 col-sm-6 col-xs-12"><input id="name" class="form-control col-md-7 col-xs-12" data-validate-length-range="6" data-validate-words="2" name="name" placeholder="both name(s) e.g Jon Doe" required="required" type="text"></div></div><div class="item form-group"><label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">Email <span class="required">*</span></label><div class="col-md-6 col-sm-6 col-xs-12"><input type="email" id="email" name="email" required="required" class="form-control col-md-7 col-xs-12"></div></div>
}

any Idea? 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>