Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

Is there a way to show text before AND after text entry fields in a Matrix Table (Constant Sum type)

MatthewM
MatthewM Chicago, IL Superuser ✭✭✭✭
edited July 8 in Custom Code

I am collecting monetary data and trying to display a dollar sign before the field, and ".00" after the field.


Is there a way to do this entirely with javascript, or with the built-in Add Symbol feature for one side, and Javascript for the other side?

Best Answer

  • ahmedA
    ahmedA India Wizard ✭✭✭✭✭
    Accepted Answer

    This will add it before:

    document.querySelectorAll("tr input").forEach(item =>{
        item.insertAdjacentText("beforebegin","$ ")})
    

Answers

  • MatthewM
    MatthewM Chicago, IL Superuser ✭✭✭✭

    Thank you @ahmedA ! And if I wanted to make the field 100px wide, what would I add? I've been using the code below previously, and it appears to work OK with your new code, but I'm a Javascript novice and don't know if that's unstable or there's a more efficient way to do this.