Use rating in a form submit?


Topic: Use rating in a form submit?

tbsn asked a year 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 a year 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,


Please insert min. 20 characters.
Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: jQuery
  • MDB Version: 4.14.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes
Tags