If you can change your markup slightly it will be more "correct" - you should not use numeric values in the id attribute.. as this id is meta data you should really use data-id="104"
If you don't want to change to data-id, simply change the JS below from
.attr('data-id')
to
.attr('id')
<div id="display_flat_details">
<div class="flat_no" id="104"><h3>104</h3></div>
<div class="flat_area" id="1650 Sq.ft"><h3>1650 Sq.ft</h3></div>
<div class="flat_price" id="75,34,544"><h3>75,34,544</h3></div>
<div class="flat_details"><input type="button" class="view_flat_details_3bhk" value="View details"></div>
</div>
And the JS
$(document).ready(function(e){
$('.flat_details input').on('click',function(e){
var flat_no = $(this).parent().siblings('.flat_no').attr('id');
console.log(flat_no);
});
});
This JS stores a variable called
flat_no