Hello @cckarman
In javascript you cannot use the “-” symbol in the variable names.
Best regards.
OK, thanks, but the syntax is correct?
This was an example to share with you, in my own script I used underscore. It did not work, however….
Hello @cckarman
I don’t know your page’s structure, so, I cannot tell you if the code is correct or not.
Best regards.
Sorry about that. The post that I am using the code in is the following:
http://www.nietzomaareentaart.nl/blauweboekje/2021/02/13/broeder/#more-292
The code that I am using is:
jQuery(window).on(‘load’, function(){
var aantal_broden=2; //I also tried ‘2’
jQuery(‘.aantal-broden’).val(aantal_broden);
});
Thanks,
Chris
Hello @cckarman
Your page does not include any element with the class name: aantal-broden
So, you cannot use the selector: '.aantal-broden'
Best regards.
Hello @cckarman
The class name is assigned to a number field in the form through its attribute: “Add CSS Layout Keyword.”. However, a field includes multiple components: the title, input tag (select tag or textarea depending on the control), and the instructions for users. So, the class name is assigned to the DIV tag that encapsulates the field’s components. If you want to assign the value to the input tag, the correct would be:
jQuery('.aantal-broden input').val(aantal_broden);
Best regards.
Many thanks!
Is there an overview of all possible tags and how to use them?
Best,
Chris
Hello @cckarman
The following post in the plugin’s blog describes the fields’ structures:
https://cff.dwbooster.com/blog/2020/01/12/form-design/
Best regards.