How do you switch between two texts in one jQuery call?

前端 未结 4 1611
有刺的猬
有刺的猬 2021-01-20 08:28

Let\'s say you have a .click() call. What code could you write inside of that .click() call so that each time you click the selected element, you c

4条回答
  •  囚心锁ツ
    2021-01-20 09:12

    $('#togglep').on('click', function(){
      $(this).text(function(st1,st2){
        if (st2=='MARKO'){return 'POLO'};
        return 'MARKO'
      })
    })
    

提交回复
热议问题