Home  >  Article  >  Web Front-end  >  冒泡提示_html/css_WEB-ITnose

冒泡提示_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:37:001197browse

有一个 CheckBox  点击是否发布,点击后ajax请求
如果成功了 则在CheckBox上提示 操作成功

自己写了一下,
$("#btnTest").click(function () {
                var top = $(this).offset().top-30;
                var left = $(this).offset().left+30;
                var id = "tip_" + parseInt(Math.random() * 10000);
                $(this).after('123');
                var tip = $("#" + id);
                tip.offset({ top: top, left: left });
                tip.fadeOut(2000, function () { $(this).remove(); });
                return;
            });

最后想封装成Jquery扩展函数

$("#btnTest").tip("保存成功");

谁有现场的插件 或扩展方法
另外能用 bootstrap 的样式 那就是极好的 

谢谢各位前端工程师了


回复讨论(解决方案)

jQuery.fn.tip = function () {      var t = $(this).html();    alert(t);};$("#btnTest").tip();

PS:如果你这里使用的input button的话,会得到空值,把你的代码移植进来就行。

没太明白楼主想要啥???
jq的click,,,处理点击,,,然后进行ajax请求,,,ajax中对于请求会有success/error....楼主将提示功能写入success中即可。。。

使用jQuery.fn.extend方法,定义几个传入的参数:url,data等,加入click方法就可以了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn