How to make textarea id to be dynamic when i looping it?


#1

I have some problem when i looping my post… This is my code… Please help me to fix it…

<form class="col s12">
		{{#each post}}
			
		<div class="col s12 m8 offset-m2 l6 offset-l3">
			<div class="card-panel grey lighten-5 z-depth-1">
				<div class="row valign-wrapper">
					<div class="col s2">
						<img src="img/ferysyukur.jpg" alt="" class="circle responsive-img">
					</div>
					<div class="col s10">
						<a href="">
							{{#if statuses this.ownerId}}
								{{firstName this.ownerId}} 
								{{lastName this.ownerId}}
							{{/if}}
						</a>
					</div>
				</div>
					 <span class="bluefont">{{desc}}</span>
					 <br>
					 <br>
					 <a href="#">Like </a><a href="#"> Comment</a>
					 <br>
						 <input type="text" class="validate" id="yourComment" placeholder="Comment">
						 <a id="addComment" href="#" class="waves-effect waves-green btn-flat"><i class="ion-android-send whitefont"></i></a>
				{{#each comments}}
				<div class="card-panel grey lighten-5 z-depth-1">
					<div class="col s2">
						<img src="img/ferysyukur.jpg" alt="" class="circle responsive-img">
					</div>
					<div class="col s10">
							<a href="#">
							{{#if statuses this.ownerId}}
								{{firstName this.ownerId}} 
								{{lastName this.ownerId}}
							{{/if}}
							</a>
					</div>
							<br>
								<br>
								
								<span class="bluefont comment">{{comment}}</span>
				</div>
				{{/each}}
			</div>
		</div>
			
		{{/each}}
	</form>

Can I looping my id=“yourComment” ? Sorry if my english is not good. :smiley:


#2

Could you be more specific on what your problem is? What are you trying to achieve that is not working?


#3

i have solutions : this in event :
var comms = ‘#commentsPost’+ this._id;
var commentsPost = t.find(comms).value.trim();

and HTML cede

because commentPost decalare in : this._id …

you try my code :smile: is very easy