单击按钮时如何在文本框中显示加载微调器? [英] How to display loading spinner in a textbox on clicking of a button?

查看:122
本文介绍了单击按钮时如何在文本框中显示加载微调器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在单击按钮时在文本框中显示加载微调器? 说我有一个用户名和密码文本框,以及一个登录按钮.输入用户名和密码并单击登录"按钮后,微调器将显示在文本框中.请帮助.我正在寻找JQuery选项或Javascript.

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 clicking on Login button, the spinners should be displayed in the textboxes. Kindly help. Iam looking for a JQuery option or Javascript.

推荐答案

假设您的html具有以下文本框:

Let's say your html has following textbox :

<input id='inputsource' />

定义一个新的CSS类

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

,然后通过jquery代码将该类添加到您的测试箱中:

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

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

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

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

这篇关于单击按钮时如何在文本框中显示加载微调器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆