更改按钮文本onclick [英] change button text onclick

查看:85
本文介绍了更改按钮文本onclick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Quicksand(可排序的filterbale流沙插件)

We are using Quicksand ( the sortable filterbale quicksand plugin )

Anyhoo ..

Anyhoo..

除了普通过滤器,用于启动流沙动画。我们还可以显示个人< li>使用一个可爱的小布局切换器。

Apart from the normal filters, to initiate the quicksand animation. We also can display the individual < li > 's by using a sweet little Layout Switcher.

代码是:

<!-- layout switcher -->
    <div id="layoutSwitcher">
        <a id="buttonsend" class="notsosmall pink button">More Info</a>
    </div>
    <!-- /end layout switcher -->

但我的问题是如果有效我想显示更少的信息。

But my issue is If active I want to display Less Info.

在正常状态下显示更多信息。

In normal state to show More Info.

我很肯定我们可以使用jQuery做到这一点

I am positive we can do this using jQuery

控制切换器的jQuery是:

The jQuery to control the switcher is:

jQuery('#layoutSwitcher a').myPortfolioLayoutSwitcher({
    show_switcher: true,
    full_width_layout: false 
});

所以我的问题很简单..我们可以更改按钮文字点击以显示更少信息更多信息视需要。

So my question is simply.. can we change button text onclick to display less info or more info as necessary.

我的

推荐答案

Easy Peasy。您只需要在两个文本跨度之间切换。

Easy Peasy. You just need to toggle between two text spans.

 <a id="buttonsend" class="notsosmall pink button">
     <span>More Info</span>
     <span style="display:none">Less Info</span>
 </a>

和一些JS

$('a#buttonsend').click(function() {
    $('span',this).toggle();
});

看到它在这里工作: http://jsfiddle.net/m9zxx/

这篇关于更改按钮文本onclick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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