0

I must use on click event. How could I click and fire a javascript function after Cloick Event. Please tell me how could I call this click function. Here is my sample of code:

     </td>
      </tr>
      <tr>
      <td colspan="3" style="padding-left:93px; "><input type="image" onClick={this.Toggle} src="${require<string>('../toolbox/image/plusv1.png')}" id="plus" alt="PlusImage" style="width:60px; height:60px;" /></td>
      </tr>
        </table>

      </div>
      </div>
  </div>`;
10
  • 2
    Can you please mention what issues you are facing? Commented Aug 28, 2019 at 10:57
  • I can't fire onClick event
    – Grzegorz Z
    Commented Aug 28, 2019 at 10:59
  • 1
    have you tried onClick={this.Toggle()} ? Commented Aug 28, 2019 at 11:00
  • 1
    debug the script and check if there is any Toggle function available in "this" Commented Aug 28, 2019 at 11:13
  • 1
    Do you see the Toggle function when you debug and type "this." ? Commented Aug 28, 2019 at 11:18

1 Answer 1

0

Can you try the below code after rendering the JSX element/ HTML :

document.getElementById("Element ID").onclick = () => this.Toggle();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.