locked
Show Parameter Value in Modal Popup RRS feed

  • Question

  • User-797751191 posted

    Hi

      I have below code . I want to show values of No & Id in Modal Popup

    function Pop(No, Id) {
                    $("#myModal").modal();
                }
    Thanks
    Friday, June 28, 2019 9:01 AM

Answers

  • User2103319870 posted

    I want to show values of No & Id in Modal Popup

    i guess you are using bootstrap modal dialog. if so then Add two controls as to Modal Body and assign value to it before opening modal diagpg

    Sample Code

    HTML

    <!-- Button trigger modal -->
    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal1">
      Launch demo modal
    </button>
    
    <!-- Modal -->
    <div class="modal fade" id="modal1" tabindex="-1" role="dialog" aria-labelledby="modal1Label" aria-hidden="true">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <h5 class="modal-title" id="modal1">Modal title</h5>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
          </div>
         <div class="modal-body">
            <input type="text" name="" id="txtNo"><br/>
            <input type="text" name="" id="txtId">
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
            
          </div>
        </div>
      </div>
    </div>

    Modified Javascript function

    function Pop(No, Id) {
    	$("#txtNo").val(No);
      	$("#txtId").val(Id);
    	$("#myModal").modal();
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 28, 2019 1:40 PM