1

I've a number field in NinjaForms where I would like to add a suffix (in my case this is a "Name your Price" where I'd like the input number to be followed by currency). I understand I should use an ::after element with content attribute, but I can't help achieving this. Could you help me?

This is the output code:

<div id="nf-field-108-wrap" class="field-wrap number-wrap" data-field-id="108">
  <div class="nf-field-label">
    <label for="nf-field-108" id="nf-label-field-108" class="">Name your donation <span class="ninja-forms-req-symbol">*</span>
    </label>
  </div>
  <div class="nf-field-element">
    <input id="nf-field-108" name="nf-field-108" aria-invalid="false" aria-describedby="nf-error-108" class="ninja-forms-field nf-element" aria-labelledby="nf-label-field-108" required="" type="number" value="50" min="25" max="" step="5">
  </div>
</div>

And this is how to field looks like:

enter image description here

Francesca
  • 23
  • 2
  • What is the code that you used? – m4n0 May 24 '22 at 08:55
  • @m4n0 I tried `input#nf-field-108::after { content: "ee" !important; }` I'd like the content to be placed just after the input inside the box (in my sample screen this would be 60ee – Francesca May 24 '22 at 12:53
  • You cannot use Pseudo elements for input fields. Please read: https://webplatform.news/issues/2020-08-26 You can make use of one of the solutions here: https://stackoverflow.com/questions/49796934/add-a-text-suffix-to-input-type-number – m4n0 May 24 '22 at 13:23
  • thankyou @m4n0 I'm unsure on how to proceed, I don't think I have (or I'm able to get) space to customize code output like that. I just add a field from ninja forms drag and drop builder and then check the output and just move with css. – Francesca May 24 '22 at 15:00

1 Answers1

0

I came up with this, not exacly what I wanted but in case of no further ideas I'll share if anyone using Ninja Form would need the same.

This is my css:

#nf-field-108-wrap > div.nf-field-element::after { content:"€" !important;...}
input#nf-field-108 {width: 100px;}

resulting in this:

enter image description here

Francesca
  • 23
  • 2