简体   繁体   中英

How to get this name from modal input

            <?php 
     $counter = 1;
     foreach ($result as $row) {
        $attributes = array(
                'method' => 'POST'
              );
     $hidden = array('is_submit' => 1);
     echo form_open('update/'.$row['id'],$attributes,$hidden);
     echo"
        <div class='modal fade' id='formModal$row[id]'>
        <div class='modal-dialog'>
            <div class='modal-content'>
                <div class='modal-header'>
                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>
                    <h4>Update Customer Details</h4>
                </div>
                <div class='modal-body'>
                    <form>
                        <div class='form-group'>
                            <label>Name</label>
                            <input type='text' class='form-control input-sm' name='uname' value='$row[name]'>
                        </div><!-- /form-group -->

I want to get the value of the name when i click on the update button i get the id for the required object but , I am not able to get the value from the input like uname(update name) phone number

May be the half code was not placed correctly.

But the i understood the question and give you a solution.

var boxInput=$(" .modal").find('input[name="uname"]').val();

I think you start other form inside form,

<div class='modal-body'>
<form>                           <!--- try to delete it               
<div class='form-group'>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM