Skip to main content
edited tags
Link
glls
  • 20.3k
  • 19
  • 49
  • 83
Source Link
Ryan Werner
  • 497
  • 1
  • 6
  • 25

LWC unable to call onclick function from input element

I am new to LWC and trying to translate an existing VF page into LWC. I am trying to call an onclick function (pretty simple) but the function is not firing. Can anyone help me troubleshoot why this onclick isn't calling my function?

LWC html page:

<div class="col-xs-8">
                    <input id="arcNumber-input" type="text" class="form-control" value={arcNumberInput}/>

                </div>
                <div class="col-xs-4">
                    <input type="submit" class="btn action-item tertiary w-margin uppercase-font"
                            id="arcNumber-submit" value={label.Sip_Common_Submit}
                            onclick={submitArcNumber}/>
                </div>

I then have a function in my LWC js controller as follows:

arcNumberInput = '';
submitArcNumber() {
    console.log(arcNumberInput);
}

However when I click the button, nothing is logged in the console. Is it because I'm using a standard input element and not lightning input? Thanks