40 questions
-2
votes
1
answer
49
views
How method chaining works in this case in JQuery
method chaining requires every method to return the jquery object but,
when we use:
$("div").click(function(){ //some code }).css("backgroundColor","blue").
how does the ...
1
vote
0
answers
134
views
Jquery Chained With Multiple values
Using Jquery Chained And Select2 With Multiple Options And Chained Select always reference First Selected Option .
<div class="col-md-6">
<div class="form-group kt-...
0
votes
0
answers
88
views
jQuery ajax call with 422 state results in chrome / edge console error even though fail function is used
Context
Calling an API from a planner tool to return events for an employer. The API returns a 422 if a certain employer does not have any events (rather strange behaviour, I would just expect an ...
0
votes
1
answer
27
views
I Want to make sure that all the functions work in a synchronous way in Jquery
I want to make sure that the after() executes only after focusout() is processed and not before that in jquery. Following is the code:
<html>
<head>
<script src="https://ajax....
2
votes
1
answer
135
views
Chaining find() to val()
Is there a way to chain find() following val()?
For example, given the following code, I would like to clear the values of all the inputs but only toggle the required property of the inputs that have ...
0
votes
1
answer
55
views
jQuery function chaining with deferred: .done()-Function instantly called
I'm trying to get some data in multiple functions and would like to chain them in order to execute the last function only when all data was properly loaded.
The problem is that the functions in the ....
0
votes
1
answer
245
views
jQuery chaining css background-color, only works once
I'm trying to chain background-color changes of a paragraph with jQuery. The following code works on the first click: change color to green, hide it, show it, then change color to yellow.
On the ...
1
vote
1
answer
530
views
Linking Bootstrap tabs to server urls
Looks like there's been much discussion on this already, but I just can't get my code work.
I have a Django project and templates with Bootstrap tab pills. I am trying to bind tab menu pills to my ...
0
votes
1
answer
89
views
How to pass selected element to 'this' in the chained functions
I am trying to understand how chained function work and in particular how is it possible to pass the selected element to the chained functions.
Assuming that we have a chained function as follow:
...
2
votes
1
answer
2k
views
Multiple chained .on('click') event listeners in jQuery
I have several click handlers on a carousel plugin (GitHub repo here).
When I initially coded it, I forgot about jQuery chaining:
$gallop.on("click", ".advance", function(){ [snip 1] })
$gallop.on("...
2
votes
1
answer
169
views
Add method to chaining in jQuery plugin
I am trying to write an auto complete jQuery plugin.
The desired usage:
$('.advancedSelect').advancedSelect({/*plugin options*/}).change(function(){})/*.otherJQueryMethods*/;
The implementation:
$....
0
votes
1
answer
62
views
Using Chained Promises with .when
I have 2 methods which return promises (shortened with non-async resolves)
function methodA () {
var d = $.Deferred();
d.resolve('A');
return d.promise();
}
function methodB (dependency) ...
0
votes
2
answers
371
views
jQuery CSS chaining background image and z-index
I have a div where an image is generated.result. I need to set a background image within that div that will act as a layer on top of the generated image. I have the following, but can't get the image ...
1
vote
3
answers
2k
views
Is it possible to chain hasClass() or is() in a conditional statement?
I noticed in my site's code that I have a lot of the following types of conditional statements:
//Example 1
if ($("#myDiv1").hasClass("myClass1")) {
$("#myDiv1").hide();
}
//Example 2
if (!$("#...
1
vote
2
answers
4k
views
Open jQuery UI Dialogs One After Another
I have multiple jQuery UI dialogs that I would like to show one after another (one closes, the next in line opens). Currently, they all display modal, but one of the back ones is larger, and it looks ...
2
votes
2
answers
3k
views
Jquery Contains and Not Contains Chaining
Image i have table like this :
<table>
<tr>
<td>Adresse IP</td>
<td class='tdSoap'>10.2.3.4</td>
</tr>
<tr>
<td&...
3
votes
1
answer
630
views
jQuery adding / chaining elements to one variable
how can I turn this into something faster:
$.each(data, function(key, val)
{
rcItemsLi.eq(index++).append('<div class="rc-item-content clear hidden"><p class="rc-item-context">' + ...
2
votes
1
answer
984
views
How should double quotes be escaped in coffeescript regular expressions?
I have the following line of coffeescript code (both dCnt and sDesc are jQuery objects), which does some basic cleaning up of a block of HTML while moving its location:
dCnt.append(sDesc.html()....
0
votes
2
answers
47
views
How to access the one of the chained functions in a plugin?
How can I access the one of the chained functions in a plugin?
this is my plugin, in which I need to return an appended element on the document.
(function($){
$.fn.extend({
...
1
vote
1
answer
65
views
Jquery - Works with Chaining but not apart
I'm an experienced developer who is new to Jquery. I'm running into a problem where I have code that works when it chained together but not when it is separate and I would like to understand Jquery ...
1
vote
1
answer
828
views
Chaining dialogs in jQuery mobile: second dialog disappears in Android
I am developing a Facebook app with jQuery mobile, where I create a dialog that creates a second dialog (chaining).
The issue is that with Android and Opera, that second dialog is displayed for a ...
2
votes
1
answer
279
views
Does .prependTo() follow the jQuery chaining?
I'm making a project, and in some line, there's a check button that when checked it relocates it's parent to the bottom. Here's it's markup :
<div id="tasksWrapper">
<div class="...
13
votes
2
answers
13k
views
Chain of Jquery Promises
I have a simple chain of events:
Get Columns from a metaData table (async)
load selected columns (async)
render list
I used to just the chain these functions, each calling the next when it had ...
0
votes
1
answer
171
views
Separate pipe() and $.Deferred.resolve()
$.Deferred(function(dfr) {
$("#container > div").each(function() {
var $div = $(this);
dfr = dfr.pipe(function() {
return $div.fadeIn();
});
});
})....
0
votes
1
answer
194
views
Custom plugin using $.ajax call breaks chaining
I have created a jQuery plugin that is used to create html on a page with the xml that it reads from a webservice call. As a backup, if the webservice call fails, there is default xml stored in a var ...
0
votes
2
answers
993
views
This JQuery code to toggle a div doesn't work in IE7, but works in other browsers
Here's my problem, I have a piece of jquery that works fine in modern browsers, but won't work in IE7.
The idea is when you click on one of the < A > tags, the div called "innerdetails" will open.
...
98
votes
3
answers
41k
views
When should I use jQuery deferred's "then" method and when should I use the "pipe" method?
jQuery's Deferred has two functions which can be used to implement asynchronous chaining of functions:
then()
deferred.then( doneCallbacks, failCallbacks ) Returns: Deferred
doneCallbacks A ...
0
votes
1
answer
356
views
How To Properly Sequence Animation Events With Procedures in JQuery
I have been having a bit of a tough time trying to sequence some animation events in JQuery with a number of other procedures that I am trying to have happen simultaneously or in a specific sequence. ...
2
votes
3
answers
2k
views
Reference to current object in Jquery chain
The following chain works:
$("</p>").html('message').hide().appendTo("#chat").fadeIn()
.parent().scrollTop($('#chat')[0].scrollHeight);
But this doesn't:
$("</p>").html('message')...
1
vote
2
answers
618
views
Execute a set of work in a loop only after the previous set has completed
I have some code that completes a distinct set of operations in a chain. The set of operations, itself, is executed in a loop. Because of the nature of the system I'm dealing with, the operation sets ...
3
votes
2
answers
426
views
How to create elements and select them on the fly with jQuery
I'm a bit stumped with this. I would like to create some elements (using jQuery), call a function on that wrapped set, and continue this process several times via a chain. For example,
$('<div id="...
0
votes
2
answers
289
views
Jquery create effect after load
I have this function:
$(".delete").live('click', function() {
var commentContainer = $(this).parent();
var id = $(this).attr("id");
var string = 'id='+ id ;
$....
0
votes
2
answers
1k
views
How does end() work for animate()?
I'm currently looking into chaining my jquery code. An element needs to ditch a border, animated. My solution: animate the borderWidth to zero and then remove the class:
$(".imgWrap", element)....
0
votes
1
answer
105
views
How to return an array of objects from a method of a jQuery plugin with chainability?
I'm writing a jQuery plugin called "myplugin" with plugin method "getSomeWhat". This methods may return a collection of somewhat, e.g. attr('id') of element(s) in ".someclass".
I'd like to maintain ...
6
votes
2
answers
10k
views
Write a jQuery Plugin that return values
I'm writing a jQuery plugin that stores some data in some cases.
I'd like to write it in a very flexible way, where I'll can change an input parameter to obtain some value that were stored by the ...
0
votes
2
answers
3k
views
nice jquery load effect
I would like to load a page inside a div with fadeTo effects.
I have created this function for that
function show(div) {
$("#showdata").fadeTo(300,0.0,function() {
$("#showdata")
...
3
votes
3
answers
1k
views
adding 'if' logic to a jQuery chain
Let's say I have the following jQuery:
// pseudocode :
$(this)
.doSomething
.doSomething
.selectSomething
.doSomething
.animate({
opacity: 1
}, 150)
...
0
votes
5
answers
9k
views
jQuery .animate/.each chaining
I'm trying to combine matching something like:
$(".item").each(function(i) {
//animation here
});
with jQuery's inherent chaining functionality that forces the animation to wait until the ...
3
votes
1
answer
1k
views
jQuery Plugin: Using callback to alter plugin behavior
I am using the jQuery token input plugin and would like change its behavior when a token is added.
I added an "onAddToken" callback to the original code so I can see when a token is added to the ...
0
votes
3
answers
771
views
Chaining the events
I have the following javascript function which will load data from a server page to the div
This is working fine with the FadeIn/FadeOut effects
function ShowModels(manuId) {
var div = $("#...