How to display loading spinner in a textbox on clicking of a button?

后端 未结 2 976
-上瘾入骨i
-上瘾入骨i 2021-02-20 12:37

How to display loading spinner in a textbox on clicking of a button? Say I have a username and password textbox, and a login button. Once i enter username and password and click

2条回答
  •  醉话见心
    2021-02-20 13:22

    Let's say your html has following textbox :

    
    

    Define a new css class

    .loadinggif 
    {
       background:
         url('http://www.hsi.com.hk/HSI-Net/pages/images/en/share/ajax-loader.gif')
         no-repeat
         right center;
    }
    

    and then adding this class to your testbox by jquery code:

    $('#inputsource').addClass('loadinggif');
    

    Jsfiddle: http://jsfiddle.net/msjaiswal/FAVN5/

提交回复
热议问题