jquery-plugins

Refresh Bootstrap ScrollSpy after Angular model changes

时光怂恿深爱的人放手 提交于 2019-12-18 03:02:30
问题 I am attempting to use the bootstrap scollspy to highlight list items generated by an angular repeater. The problem I'm running into is that I'm refreshing the scrollspy plugin from an angular controller, before angular has applied the model changes to the view. What is the angular way to ensure the scrollspy('refresh') call happens after the DOM itself has been updated (not just the angular model)? Template: <div class="span2" id="addressList"> <ul class="nav nav-tabs nav-stacked affix"> <li

autocomplete with contenteditable div instead of textarea doesn't seem to work

旧时模样 提交于 2019-12-18 01:22:08
问题 I'm using the autocomplete plugin by Andrew Whitaker, also referenced in this question: jquery autocomplete @mention This doesn't work if I use a contenteditable div instead of a textarea. Here's my code: <div id="MyText" contenteditable="true"></div>​ $("#MyText").bind("keydown", function (event) { if (event.keyCode === $.ui.keyCode.TAB && $(this).data("autocomplete").menu.active) { event.preventDefault(); } }).autocomplete({ minLength: 0, source: function (request, response) { var term =

.post inside jQuery.validator.addMethod always returns false

泄露秘密 提交于 2019-12-18 01:20:47
问题 I am very new to jQuery and javascript programming. I have a program below that checks whether username is taken or not. For now, the PHP script always returns if(isset($_POST["username"]) )//&& isset($_POST["checking"])) { $xml="<register><message>Available</message></register>"; echo $xml; } Login function works, but username checking doesn't. Any ideas? Here is all of my code: $(document).ready(function() { jQuery.validator.addMethod("checkAvailability",function(value,element){ $.post(

jQuery Validate (Date Range)

自古美人都是妖i 提交于 2019-12-17 22:44:13
问题 Im using the jQuery validate plugin and was wondering if there was a way to validate if the date entered into a field was a date like yyyy-mm-dd AND the the date falls between Nov 29 2010 - Dec 15 2010 Im pretty new to jQuery so if there is an answer please dumb up the answer as much as possible so i can get through it. Thanks a lot for any/all suggestions 回答1: If you want a reusable function, you might extend Emily and lonesomeday's answers to allow an argument to be provided: $.validator

Change Bootstrap modal option once it already exists

纵然是瞬间 提交于 2019-12-17 22:26:28
问题 I'm using Bootstrap Modal. I declare it, I call it, I show it...everything seems to be ok. But what if I have an already existing modal previously shown with "keyboard" property to false and I want to change it on the go? I mean something like: First, I create a Modal doing this (as you can see, I declare the modal putting keyboard property to false): $('#myModal').modal({ show: false, backdrop: true, keyboard: false }); But then I declare this event handler, that means that if "something"

How does extend() work in jQuery?

荒凉一梦 提交于 2019-12-17 21:38:57
问题 I saw this in a plugin: var options = $.extend(defaults, options); How does it work? What does extend() do? 回答1: Multiple Parameters The documentation isn't precise in explaining how extend works, so I ran a little test: var a = {foo: 1, bar: 1}; var b = {foo: 2, baz: 2}; var c = {foo: 3}; var r = jQuery.extend(a,b,c); console.log("A: Foo=" + a.foo + " Bar=" + a.bar + " Baz=" + a.baz); console.log("B: Foo=" + b.foo + " Bar=" + b.bar + " Baz=" + b.baz); console.log("C: Foo=" + c.foo + " Bar="

For the function (function($){})(), I've seen it with the word jQuery in it, why is that?

喜夏-厌秋 提交于 2019-12-17 21:34:24
问题 For the function (function($){})(), I've seen it with the word jQuery in it, why is that? I have read this page Javascript: why does jQuery do this: (function(){ ...});, and how does it work? but it didnt tell about an example like this: (function($){})(jQuery); What does that jquery in the parenthesis do? If the parenthesis by itself already self calls the function then why do we need that jQuery in there? 回答1: Is a simple function invocation, the jQuery object is sent as an argument to the

How to make editable list item using jQuery?

六月ゝ 毕业季﹏ 提交于 2019-12-17 20:27:21
问题 I want to display user information in a listview with data pulled from a DB. Now my target is to make the listview editable so that when a user clicks on any listview, it responds like a "Textbox" and a keyboard appears (for mobile). After editing, the user can press a "save" button to save his/her editable contents to the DB. I am using HTML, jQuery, and CSS with the Adobe PhoneGap API. 回答1: I have created a fiddle and i think this is what you want : http://jsbin.com/ijexak/2/edit In fiddle

Is it possible to trigger the onbeforeunload event programmatically?

不打扰是莪最后的温柔 提交于 2019-12-17 19:58:09
问题 I'm currently using the jquery-form-observe plugin which uses onbeforeunload to prompt the user about "unsaved" changes. But I have a scenario where I need to trigger this on a button click: the button click ultimately leads to the page changing, but I want to prompt the user before they start the process that the button click kicks off... So is there a way to trigger onbeforeunload through jQuery or otherwise? 回答1: I don't know if there is a direct way to do this, but you could always

How to detect an audio has finished playing in a web page?

☆樱花仙子☆ 提交于 2019-12-17 18:39:42
问题 In my project, I need to embed audio (ex: mp3, etc) into a web page. When user visits the page, the audio will begin playing. When the audio ends, the questionnaire (form fields) will appear for the user to answer. Is there is way to check if the audio has finished playing using jquery, so that the questionnaire can appear after the user has listened to the entire audio? I know one way to check is to determine the audio length, then I can set a timer to display the questionnaire, but I'm