• Resolved tilou

    (@tilou)


    Hi

    How can I use a calculated field, in the HTML style element?

    i.e:

    <style>
      .item { 
          width: "this is where I want the field result";
      }
    </style>

    Thanks

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @tilou

    The alternative would be redefine the style as a whole.

    For example, insert a “HTML Content” field in the form with the style tags as its content:

    
    <style id="runtime">
    .item { 
        width: 300px;
    }
    </style>
    

    and then, you can use the following piece of code as part of the equation associated to the calculated field:

    
    (function(){
    var w = fieldname1+fieldname2;
    jQuery('#runtime').html('.item {width: '+w+'px;}');
    })()
    

    and that’s all.
    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Using calculated field in CSS style element?’ is closed to new replies.