I want to change the value of a Ninja Form input with jQuery, eg:
$('#ninja_forms_field_6').val(somevalue);
But this just wont work, probably because values and calculations are done in the back by PHP.
A + B gives me the Total
What I want is ether to have jQuery “auto type” text into field or to extract given value of the total input.
I said “auto type” because A and B values are being calculated only when I manually type them on keyboard. When I used $('#ninja_forms_field_6').val(somevalue)
– the value shows up as if it is typed but calculation does not happen.
The other solution for me is to get the calculated value/text that shows up in the Total input after calculation, but as you can see in the image the input tag stays empty.
<input id="ninja_forms_field_8" name="ninja_forms_field_8" value="0" disabled="" class="ninja-forms-field " rel="8" type="text"></input>
Input for the total stays empty whether its showing the result or not.
If you can help me with this, you would have my eternal gratitude.
Try to trigger a “change” event after changing the value of the field:
That worked for me in some select fields, I don’t know if it will work on other types of fields. Maybe trying some other jquery event type will work if “change” does not.
If you are trying to change a field in Ninja Forms 3.2.1, it appears that Ninja Forms 3 has changed
#ninja_forms_field_
to#nf-field-
as documented here: http://developer.ninjaforms.com/codex/changing-field-values/I have not been able to successfully change a field in Ninja Forms 3.x and I would appreciate any tips from those who have been successful.