I have a problem to get particular textbox value inside a loop using jquery. please see the below code. I will get 1 to 10 values all the textbox next to print the button. when I submit that particular textbox value, it will always coming that first value as "1".
I know in jquet code I have to put "$this" key word to get that particular value, but I am new to jquery and I tried so many methods to do that, I failed. please help.
<?PHP for($i=0, $i<10; $i++) ?>
<input type="text" name="ad_id" value="<?PHP echo $i; ?>" class="ad_id" />
<button type="button" class="ad_increase">Submit</button>
<?PHP } ?>
<script>
$('.ad_increase').click(function() {
var get_ad_id = $('.ad_id').each();
$.post('includes/show_ad_id.php', {
ad_id: get_ad_id
}, function(res) {
if (res != 1) {
$('.display_in_model').html(res);
} else {
$('.display_in_model').html('');
}
});
});
</script>