Get value from table in option select


Topic: Get value from table in option select

Hoteentot asked 5 years ago

I am trying to get the value from editable table in a select option in modelEdit form. The first option value should be the value from the editable table. The "id = Klas" .How do I get the id = Klas in first row of selection

This is my code:

                <main>
                  <div class="container">
                     <div class="row text-center">
                       <div class="col-12">
                            <select class="mdb-select md-form" id="Klas">
                                <option value="1">test1</option>
                                <option value="2">test2</option>
                                 <option value="3">test3</option>
                            </select>
                                 <label class="mdb-main-label" for="documentStatus">Klas</label>
                      </div>
                   </div>
                 </div>
               </main> 



  <script language="javascript">
    $(document).ready(function () {
        $('.mdb-select').materialSelect();
    });
</script>

Mateusz Łubianka staff answered 5 years ago

Hi Hoteentot!

If you want get the value from one element and display in another, you can add the id's and use $('#id').innerText jQuery function. First time to get value and after that to paste it in another element.

Best regards,


Hoteentot commented 5 years ago

Is there any example how to fix


Mateusz Łubianka staff answered 5 years ago

Hi,

please, create a snippet showing your problem here: https://mdbootstrap.com/snippets/. I'll try to help you.

Best,


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.11
  • Device: computer
  • Browser: firefox
  • OS: windows 7
  • Provided sample code: No
  • Provided link: No
Tags