I want to update the status of permission time by time and the permissions will be given depending on the role given.
Each role has its own Id and it is being displayed but I also have to update permission with respect to the Role id but with foreach loop is given out to the form my UI is just scattered. So any way how to give id to the form to update the elements in form.
I am getting Id through javascript but it always give first id of the loop.
Blade.php
<div class="col-lg-3 col-md-3">
<a href="#" id="createType" class="btn btn-primary btn-block" data-toggle="modal" data-target="#myModal"><i class="fa fa-plus"></i> Add Positions</a>
@foreach($data as $key=>$item)
<div class="roles-menu">
<ul class="nav" id="item_id" onclick="item()">
<li><a href="" onclick="giveinput()"></a></li>
</div>--}}
</ul>
<input id="input" value="">
</div>
@endforeach
</div>
<form method="post" action="">
<div class="col-sm-9 module-access">
<h6 class="panel-title mb-20 display-ib">Module Access</h6>
<div class="pull-right mb-10">
</div>
<div id="divID"></div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-md-12 text-right">
<button class="btn btn-info">Save</button>
</div>
</div>
</form>
script
<script>
function giveinput(){
$("#input").each(function() {
var input=document.getElementById("input").value;
var div = document.getElementById('divID');
div.innerHTML = div.innerHTML + input;
alert(div.innerHTML );
e.preventDefault();
});
}
</script>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire