javascript - Run jquery function after another function completes -


i want execute custom jquery function after custom function completes use timer func2. not correctly solution. how can write it؟

function fun1() {      $('#sidenavbox .root.static > li.static').each(function(){  	    if($(this).find('ul').length){          $(this).addclass('remove');}  	    $('#sidenavbox .root.static > li.remove > a').replacewith(function(){  	        return $('<span class="additional-background ms-navedit-flyoutarrow">'+$(this).html()+'</span>' );          });      });  };    settimeout(      function fun2() {          $('#sidenavbox .root.static > li.father > span').removeclass('additional-background ms-navedit-flyoutarrow');          $('#sidenavbox .root.static > li.father > span').addclass('static menu-item ms-core-listmenu-item ms-displayinline ms-navedit-linknode');           //do special  }, 1000);

you call fun2() inside fun1()

like this

function fun2() {     $('#sidenavbox .root.static > li.father > span').removeclass('additional-background ms-navedit-flyoutarrow');     $('#sidenavbox .root.static > li.father > span').addclass('static menu-item ms-core-listmenu-item ms-displayinline ms-navedit-linknode');      //do special }  function fun1() { $('#sidenavbox .root.static > li.static').each(function(){     if($(this).find('ul').length){     $(this).addclass('remove');}     $('#sidenavbox .root.static > li.remove > a').replacewith(function(){         return $('<span class="additional-background ms-navedit-flyoutarrow">'+$(this).html()+'</span>' );     }); });  fun2() ;//call function 2 } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -