Title: get value from post
Last modified: February 16, 2021

---

# get value from post

 *  Resolved [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/)
 * A short question: I am trying to set my values though JQuery in the post. The
   following felt logic (based on your examples in this forum) but is not working:
 * var my-num = 3;
    jQuery(‘.my-field’).val(my-num);
 * Where am I going wrong?
    And what if I wanted to add a calculation, e.g., my-
   num*fieldnum1 ?
 * Best,
    Chris

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14058920)
 * Hello [@cckarman](https://wordpress.org/support/users/cckarman/)
 * In javascript you cannot use the “-” symbol in the variable names.
 * Best regards.
 *  Thread Starter [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14058978)
 * 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….
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14058988)
 * Hello [@cckarman](https://wordpress.org/support/users/cckarman/)
 * I don’t know your page’s structure, so, I cannot tell you if the code is correct
   or not.
 * Best regards.
 *  Thread Starter [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14059263)
 * 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](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
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14059276)
 * Hello [@cckarman](https://wordpress.org/support/users/cckarman/)
 * Your page does not include any element with the class name: `aantal-broden`
 * So, you cannot use the selector: `'.aantal-broden'`
 * Best regards.
 *  Thread Starter [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14059435)
 * Sorry for the confusion, this is the correct link:
    [http://www.nietzomaareentaart.nl/blauweboekje/2021/02/06/elementor-15/](http://www.nietzomaareentaart.nl/blauweboekje/2021/02/06/elementor-15/)
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14059505)
 * Hello [@cckarman](https://wordpress.org/support/users/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.
 *  Thread Starter [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14059547)
 * Many thanks!
    Is there an overview of all possible tags and how to use them?
 * Best,
    Chris
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14059820)
 * Hello [@cckarman](https://wordpress.org/support/users/cckarman/)
 * The following post in the plugin’s blog describes the fields’ structures:
 * [https://cff.dwbooster.com/blog/2020/01/12/form-design/](https://cff.dwbooster.com/blog/2020/01/12/form-design/)
 * Best regards.
 *  Thread Starter [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14059875)
 * 👍👍

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘get value from post’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [cckarman](https://wordpress.org/support/users/cckarman/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/get-value-from-post/#post-14059875)
 * Status: resolved