• Resolved yourlaks

    (@yourlaks)


    The statuts show in the input field. However, Is it possible to display weight status value in the html text instead of an input filed.

    My code:

    (function(){
    var average = fieldname4;
    if(average<18.5) return ‘Underweight’;
    if(average<25) return ‘Healthy’;
    return ‘Overweight’;
    jQuery(‘.status-here’).html(average);
    })()

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @yourlaks

    Yes, of course. That’s possible.

    I assume you have inserted an “HTML Content” field or similar with a tag with the class name status-here, and you want to display the equation’s results into this tag.

    Please, edit the equation as follows:

    
    (function(){
    var result = 'Overweight', average = fieldname4;
    
    if(average<25) result = 'Healthy';
    if(average<18.5) result = 'Underweight';
    
    jQuery('.status-here').html(result);
    
    return result;
    })()
    

    The return instruction returns the equation’s value and moves the execution outside the equation’s code. So, it must be after the assignment of the value to the status-here tag. Furthermore, please, pay attention to the order of the conditional statements. I’m assigning the values to the result variable from the most general to the most restrictive.

    Best regards.

    Thread Starter yourlaks

    (@yourlaks)

    You’re a legend!

    Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to Send Output to a HTML Page?’ is closed to new replies.