jquery - How to automatically trigger button click? -


i have code automatically trigger click event of button inside function of same button here html button:

<a class="button widget uib_w_4 d-margins icon user black" data-uib="app_framework/button" data-ver="1" id="btnconnecter" onclick="mycallback()"  href="" > 

and here content of mycallback function:

function mycallback(data) {     test=false;       var eml = document.getelementbyid("tbemail").value;     var mp = document.getelementbyid("tbmdp").value;      $.each(data.user, function (i,data)      {         if((data.email==eml )&&(data.mdp==mp))            test=true;     });        if (test==true)     {         $("#btnconnecter").href="#acc";         $('#btnconnecter').trigger( "click" );        }     else     intel.xdk.notification.alert("verifier votre email/mot de passe"); } 

the problem click event not triggered. problem?

try adding closing tag , text. works in standard html. not sure if trigger.io framework affecting functionality.

<a id="btnconnecter" onclick="mycallback()"  href="" >some text</a> 

also, add simple line in function see if problem not being called, or function logic not working. first step take determine root cause when think function not being called.

alert("in call back");