In this my textboxes are generated by using JavaScript.In my controller I place the code for CodeIgniter validation. But I am confused about how to put the
<?php echo form_error(); ?>
how to append this in javascript
<div id='exp_error'>
<?php echo validation_errors(); ?>
</div>
but this message displayed in all places..I want only in my link
script
<input name="exp_amount_'+unqid1+'" id="id_'+unqid1+'" type="text" '+
'class="form-control" placeholder="Enter '+name+' expense amount" style="margin-right:20px;" required>'
+'<input name="comment_'+unqid1+'" type="text" id="comment" class="form-con" placeholder="Comments" style="margin-right:20px;" required ></div >' ;
controller
$this->form_validation->set_rules('exp_amount_'.$required_id, 'Expense Amount', 'required|numeric');
$this->form_validation->set_rules('comment_'.$required_id, 'Comments', 'required');