Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Input Value Problem

Kenshai free asked 5 years ago


Hi, i using a mdb. I have a input value problems. input text does not see that it has a value.Not Clicked :http://prntscr.com/pnk1krClicked: http://prntscr.com/pnk21y

Modal Script:

        $(() => {
        $('.login-btn').click(function () {
            $('#txt_price').val($(this).attr('data-price'));
            $('#txt_balance').val($(this).attr('data-balance'));
            $('#modalLoginForm').modal();
            return false;
        });
    });

Modal View;

            <div class="modal fade" id="modalLoginForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
             aria-hidden="true">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header text-center">
                        <h4 class="modal-title w-100 font-weight-bold">Update Data</h4>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">×</span>
                        </button>
                    </div>
                    <div class="modal-body mx-3">
                        <div class="md-form form-sm">
                            <input type="text" id="txt_price" class="form-control form-control-sm">
                            <label for="txt_price">Price</label>
                        </div>

                        <div class="md-form form-sm">
                            <input type="text" id="txt_balance" class="form-control form-control-sm">
                            <label for="txt_balance">Balance</label>
                        </div>
                    </div>
                    <div class="modal-footer d-flex justify-content-center">
                        <button class="btn btn-default">Update</button>
                    </div>
                </div>
            </div>
        </div>

I want it to be like the second picture. How to fix problem? Thanks..


Bartłomiej Malanowski staff commented 5 years ago

There's no data-price and data-balance in your inputs. Am I missing something?



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.10
  • Device: Computer
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes