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: Use rating in a form submit?

tbsn free asked 4 years ago


Expected behavior I have a form where I will use the rating addon but is it possible to get the rating value from the span id and sendt it when push a submit form button, like input field with a name?

Actual behavior Only a span id

Resources (screenshots, code snippets etc.) https://mdbootstrap.com/plugins/jquery/rating/


Mateusz Łubianka staff answered 4 years ago


Hi @tbsn,

You can use something like the code below:

 const doSubmit = (e) => {

    const vote_value = $('#root-element).find('.stars.amber-text').length;
    ...
}

Elements with .amber-text class - checked stars.

Best,


octagon free commented 3 years ago

Thanks so much! This has helped me.



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

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