How can I trigger the click event of another element in ng-click using angularjs?

前端 未结 12 1650
耶瑟儿~
耶瑟儿~ 2020-12-03 04:05

I\'m trying to trigger the click event of the element from the button.



        
12条回答
  •  日久生厌
    2020-12-03 04:49

    best and simple way to use native java Script which is one liner code.

    document.querySelector('#id').click();

    Just add 'id' to your html element like

    check condition in javascript code

    if(condition) { document.querySelector('#myId1').click(); }

提交回复
热议问题