Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139923

Why it's not fetching the data from the modal?

$
0
0

PS: The datas are already displaying on browser

The only problem is I'm not fetching the data when opening the modal and I want to edit the current info into new info using the modal

I think the problem is when every time i am closing the table row 'cause the table is designed vertically

this is the javascipt

<script >
            $(document).ready(function(){
                $('.editbtn').on('click', function(){
                    $('#myModal').modal('show');
                $tr = $(this).closest('tr');
                var data = $tr.children('th').map(function(){
                    return $(this).text();
                }).get();

                console.log(data);
                $('#update_id').val(data[0]);
                $('#first_name').val(data[1]);
                $('#last_name').val(data[2]);
                $('#email_address').val(data[4]);
                $('#contact_number').val(data[5]);
                $('#home_address').val(data[6]);

                });
           });
   </script>

Viewing all articles
Browse latest Browse all 139923

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>