Say I have jquery code like this:
html += '<div class="index">' + item.index + '</div>';
// many more similar html += statements
// load items
$('div').append(html);
This html is getting too unmanageable, so I'd like to move it to an external file. What's the best way to pass variables to the HTML as i load it? Do i just have to loa...
Hi,
I am using a highly modified version of the jqueryFileTree plugin, that is able to add new files and folders. When a new file is created in realtime I have to bind the tree again to the click event so that all new files and folders can work as intended.
Just re-binding the filetree has caused me some trouble with the functionality ...
I am relatively new to jQuery but the below code seems logical but is not working as I would expect. I am utilizing the Colorbox jQuery plugin.
My intention is to only add a listener for the 'cbox_closed' event on 'a' elements who have an id that contains 'Remove'. Unfortunately, as presently implemented this adds the listener on all ra...
Summary
I am using jQuery to clone a div ("boxCollection") containing groups ("groupBox") each of which contains a set of inputs. The inputs have change events tied to them at $(document).ready, but the inputs inside the cloned divs do not respond to the event triggers. I can not get this to work in IE7, IE8, or FF3.
Here is my sam...
I'm working with some existing javascript code which takes an LI and makes it droppable to an input field. I wanted to add an additional constraint to this, and enforce this by making my own event handler, and calling event.stopImmediatePropagation() if the constraint is not met.
This existing javascript is look like this:
$input.droppa...
The dynamically added links (classnames .divToggle and .removeDiv) only function if clicked twice the first time. What is preventing them from working properly right away?
$(document).ready(function(){
// adds click event to links.
$('a.divToggle').live('click', function(event) {
// Toggles the visibility of divs.
event.preventD...
Hi,
I have a div which I have attached an onclick event to. in this div is a a tag with a link. when i click the link the onclick event from the div is also triggered. how can i disable this so that if the link is clicked on the div onclick is not fired.
script.
$(document).ready(function(){
$(".header").bind("click", fun...
Hello,
I am new to the group and just had a simple question about the jQuery(window).load(function() {});.
I have an external JS file that gets inserted dynamically on the page "after" the window load event occurs. Inside this JS file I have a statement as follows:
jQuery(window).load(function() {
alert("Something");
});
The que...
Hi Everyone,
I'm running into a problem with jquery live event binding on a link. When the link is added to the page it works fine, however when another link is added to the unordered list it requires two clicks for the click event to fire on either link. Any ideas?
$("div#website-messages ul li a").live("click", function() {
var...
Is there another way to run a regular JS function with params passed than what I use below ?
It seems redundant use a on-the-way function to do this.
function regularJSfunc(param1,param2) {
// do stuff
}
$(document).ready(function(){
$('#myId').change(function(){
regularJSfunc('data1','data2');
});
}
Using a .bind event ...
I'm populating a list by cloning elements into it. Then I change attrs to make each item unique. They need to call a function on click, so I'm wondering if it's more efficient to use new_element.click(func); or new_element.attr('onlick','func();');
...
I need to be able to set the order of event handlers for a click event using Prototype. I need to insert an "Are you sure?" pop-up before an Ajax call modifies data. Due to the way the program is structured, I can't change the order of js click bindings.
I love jQuery and there's an elegant solution to this problem right here on Stack...
Hello all.
I've done some experimenting, but can't seem to successfully bind one event handler to multiple elements using jQuery. Here's what I've tried:
$('selector1', 'selector2').bind('click', function() {
$('someSelector').removeClass('coolClass');
});
I've tested all my selectors, and they are all valid.
Is what I'm t...
So I'm using the jQuery date picker, and it works well. I am using AJAX to go and get some content, obviously when this new content is applied the bind is lost, I learnt about this last week and discovered about the .live() method.
But how do I apply that to my date picker? Because this isn't an event therefore .live() won't be able to ...
Overview of the problem
In jQuery, the order in which you bind a handler is the order in which they will be executed if you are binding to the same element.
For example:
$('#div1').bind('click',function(){
// code runs first
});
$('#div1').bind('click',function(){
// code runs second
});
But what if I want the 2nd bound code to ru...
I'm trying to determine when any of a set of named input/select/radio/checked/hidden fields in a form change.
In particular, I'd like to capture when any changes are made to fields matching jQuery's selector $("form :input"), and where that input is has a name attribute. However, the form isn't static i.e. some of the fields are dynami...
I've build a site that has accordion sections that expand whenever someone clicks on the header section for that page, the click handler is placed on
$('.section h2').click
However, when a user is logged in as admin, there are 'EDIT' links applied to the header, so I only want the section to expand if the area clicked is not "a.edit-...
I am trying to get an autocomplete working and making an Ajax form submission on change, and so far the first is working but not the second. I am using jQuery UI Autocomplete with Combobox, http://jqueryui.com/demos/autocomplete/#combobox. From my Django template, I define a handler, presently beginning with an alert that seems never to ...
Hi all,
Is there a way I can call the second function in toggle(function(){},function(){})
Thanks in advance
...
Hi,
Let me explain the problem first. I am using the following UL structure
<ul onmouseover="smenu_over(this)" onmouseout="smenu_out(this)" class="sub-menu" style="left:0;">
<li><a href="#">Navigation Item with long text do text wrap</a></li>
<li><a href="#">Sub nav item</a></li>
<li><a href="#">Sub...