I have three dynamically generated div. Each contains different data and buttons.On each button click I want to alert the data. I have this. but it only shows the first div data for each button click.
form. this form generate dynamically
<input type="hidden" name="price" id="price" class="price" value="
{{$data->price}}"/>
<input type="submit" name="submit" id="button1" class="btn btn-danger
btn-lg raised button1"/>
<div>
<script>
$('.button1').on('click', function(){
var id = $('.price').val();
alert(id);
});
</script>