Set form field value with Jquery not workingRésolue
06-20-2019 06:56 - modifié 06-20-2019 09:14
I'm trying to prepopulate a field on a HS form with JQuery (everything lives on a Vue app).
I have read a topic that explicitely says that the value change should be chained with a ".change()" method.
I've done that and, for debug puposes, I'm pre-populating the form on "hsFormCallback[onFormReady]" event. So that when I launch the page, the field is populated with my value. So far so good. Here is the code I'm using :
var score_global = $("input[name='score_global']"); score_global.val(123).trigger('change');
However, when I enter some text, in any other field available on the form, the prepopulated value disappears. It seems as if the hsforms script doesn't refresh with the trigger('change') (it does the same if I use .change() instead).
Can anyone guide me here, I don't know what to attempt now?
Résolu ! Accéder à la solution.