Tag: jQuery

如何在jQuery中子string

我怎么能在客户端使用jQuery的子string“nameGorge”并删除“名称”,所以它只输出“峡谷”? var name = "nameGorge"; //output Gorge

将dropzone.js与其他字段集成到现有的HTML表单中

我目前有一个HTML表单,用户可以填写他们希望发布的广告的详细信息。 我现在想要能够添加一个dropzone上传图片的项目出售。 我发现dropzone.js似乎做我需要的大部分。 但是,在查看文档时,似乎需要将整个表单的类指定为“dropzone”(而不仅仅是input元素)。 这意味着我的整个表单变成了dropzone。 是否有可能在我的表单的一部分使用dropzone,即只通过指定元素作为类dropzone,而不是整个forms? 我可以使用单独的表单,但我希望用户能够使用一个button来提交。 或者,有另一个图书馆可以做到这一点? 非常感谢

jQuery show()函数显示内联块。 怎么样?

我有这样的代码 function switch_tabs(obj) { $('.tab-content').hide(); $('.tabs a').removeClass("selected"); var id = obj.attr("rel"); $('#'+id).show(); obj.addClass("selected"); } 显示function添加显示:块。 但我想添加显示:内联块,而不是块。 有人能帮我吗? 谢谢

input号码隐藏微调 – Firefox 29

在Firefox 28上,我使用的是<input type="number">因为它在input字段中只显示数字键盘。 在Firefox 29中,使用数字input在字段的右侧显示旋转button,这在我的devise中看起来像垃圾。 我真的不需要button,因为无论如何,当你需要写一个6〜10位数字的东西时,它们是无用的。 是否有可能禁用CSS或jQuery的这个?

使用jquery获取所有选中的checkbox与某个类的名称

我知道我可以使用这个在页面上的所有选中的checkbox: $('input[type=checkbox]').each(function () { var sThisVal = (this.checked ? $(this).val() : ""); }); 但是我现在在一个页面上使用了这个,它有一些我不想包含的checkbox。 我怎样才能改变上面的代码,只看看checkbox上有一个特定的类?

Bootstrap 3和Youtube在Modal中

我正在尝试使用Bootstrap 3中的Modalfunction来显示我的Youtubevideo。 它的工作原理,但我不能点击Youtubevideo中的任何button。 任何帮助吗? 这是我的代码: <div id="link">My video</div> <div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body"> <iframe width="400" height="300" frameborder="0" allowfullscreen=""></iframe> </div> </div> </div> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/jquery-1.10.1.min.js"><\/script>')</script> <script src="js/bootstrap.min.js"></script> <script> $('#link').click(function () { var src = 'http://www.youtube.com/v/FSi2fJALDyQ&amp;autoplay=1'; […]

从其他控制器调用指令控制器中的方法

我有一个指令,有自己的控制器。 看下面的代码: var popdown = angular.module('xModules',[]); popdown.directive('popdown', function () { var PopdownController = function ($scope) { this.scope = $scope; } PopdownController.prototype = { show:function (message, type) { this.scope.message = message; this.scope.type = type; }, hide:function () { this.scope.message = ''; this.scope.type = ''; } } var linkFn = function (scope, lElement, attrs, controller) { }; […]

用jQuery处理元素ID中的冒号

我们无法使用jQuery在JS代码中访问ID为“test:abc”的div元素。 <div id="test:abc"> $('#test:abc') 它没有冒号工作正常。 我们没有对ID生成的控制,因为它是在Trinidad子表单中自动生成的,因为它将子表单ID与:附加到其中的每个元素。

jquery如何清空input字段

我在一个移动应用程序,我使用一个input字段,以便用户提交一个数字。 当我返回到input栏显示在input栏中显示的最新数字input的页面时。 每次页面加载时有没有办法清除字段? $('#shares').keyup(function(){ payment = 0; calcTotal(); gtotal = ($('#shares').val() * 1) + payment; gtotal = gtotal.toFixed(2); $("p.total").html("Total Payment: <strong>" + gtotal + "</strong>"); });

如何让jQuery限制上传文件types?

我想有jQuery限制file upload字段只有jpg / jpeg,png和gif。 我正在做PHP后端检查。 我正在通过JavaScript函数运行我的提交button,所以我只需要知道如何在提交或提醒之前检查文件types。