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? Aug 28, 2019 at 10:57
  • I can't fire onClick event
    – Grzegorz Z
    Aug 28, 2019 at 10:59
  • 1
    have you tried onClick={this.Toggle()} ? Aug 28, 2019 at 11:00
  • 1
    debug the script and check if there is any Toggle function available in "this" Aug 28, 2019 at 11:13
  • 1
    Do you see the Toggle function when you debug and type "this." ? 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 that you have read and understand our privacy policy and code of conduct.

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