Jump to content

If Statement Fun


Recommended Posts

I have a load of data coming from the database, of which I have not control of. When it comes in I am putting it in an html table.

I have set up a basic if statement: If it is a blank field, show 'NA'. If not, show the figures in an input that a user can edit.

The trouble I am running into is if a user backspaces the characters in the input, it then of course beomes the static text 'NA', but I need it to remain an input!

What can I do in this scenario to prevent this from happening? I am using Vue.js, below is what I am using: 

                        <div v-if="item.value === ''">
                            NA
                        </div>
                        <div v-else>
                            <input class="input is-small" v-model="item.value">
                        </div>

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...