bipin

how to pass dynamic selector value to jquery

Posted 1 year ago by bipin

Hello guys here, i m trying to get dynamic input id value into jquery here is my view

                       <select class="selectpicker form-control " id="applicantstatus[{{$s->id}}]" name="applicantstatus[{{$s->id}}]" data-style="btn-info btn btn-xs" data-posttd="{{$s->id}}" data-width="auto" >  <option >Select</option>
                                  <option   value="Processing" >Processing</option>     
                                  <option   value="Hired">Hired</option>
                                  <option   value="Reject">Rejected</option>
                                  <option   value="RollBack">RollBack</option>
                               </select>
                               
                                </td>
                                <td class="text-right footable-visible footable-last-column">
                                    
                                    <div>
                                            
                                         
                                        <a class="btn-success btn btn-xs setvalue" data-id="{{$s->id}}">Save</a>

                                    </div>
                                </td>

here is my script

                           <script type="text/javascript">
    $(document).ready(function() {
 
   $('.setvalue').on('click', function() {
    debugger
       var id = $(this).attr("data-id");
       var new1 = id;
        var inp =  $('#applicantstatus[new1]').val();
    
  
        });

});

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.