JQuery :: Using AddClass Function With Live

Feb 19, 2011

I am trying to use the .live() jQuery function in cooperation with the .addClass() function, but I am unsure of how exactly to pass the parameter of the class-to-be-added's name through the live() function to work with addClass().Here is an example of the jQuery I would be using: [code]

I would like to use addClass() in both instances in the code above in cooperation with live() while being able to pass the class's name through the live() function. I've searched around the web quite a bit, but none of my searches have resulted in an answer that fits my specific needs.

View 2 Replies


ADVERTISEMENT

JQuery :: Live() And AddClass() - Clicking Certain Links Fetches A Comment Form

Oct 24, 2010

Using 1.4.1. A comments app. Clicking certain links fetches a comment form which displays below. The button then becomes a "cancel" link. Clicking that removes the form and sets the button back to its original state. Or so it should. I'm seeing some strange behavior. Some strange, but understandable, some not so much.

Basic code:

After removing the form, my code fetches it again and re-displays it. The problem appears to be that click event isstill "happening" and so live() fires immediately. I tried using stopPropagation(), which keeps the form from re-loading but for some reason also keeps displayFormHandler from being run on subsequent clicks.

I saw a hint in the comments for stopPropagation() and added, in cancelFormHandler:

And:

Again, this keeps the form from re-displaying but, bizarrely, causes displayFormHandler to always return false (the console.log() line runs every time). I can understand why the original problem happens but this doesn't make any sense at all. If the class has been removed, subsequent clicks should proceed normally because hasClass() is being evaluated at the time of the click, not when live() is called.

View 3 Replies View Related

JQuery :: .click Function Won't Work Twice AddClass?

May 19, 2009

I want to change the color on every click of the div, by changing theclass and checking if hasClass. First removeClass, then addClass.But this won't work?Live demo:

http://www.edwinistrator.com/stuff/jquery/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">

[code]....

View 1 Replies View Related

JQuery :: AddClass Function On A SVG Circle Doesn't Work

Oct 7, 2010

i have the following test code in my html page

<div id="drawingArea">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="700" height="400"> <circle id="example" cx="335.4999" cy="234.38927" r="8" style="cursor: move;" fill-opacity="0.1"></circle> </svg></div>

[Code].....

Iam using Raphael and add the same question in their google group too, but they said, its jquery specific. I think, jquery doesnt found my circle. Maybe different id - handling between SVG-specific and plain DOM elements?

View 3 Replies View Related

JQuery :: Addclass Function Only Works With First Of Matched DIVs

Jul 16, 2009

I'm having an annoying issue with addClass(). I'm trying to find all divs with id name '#moldura_slides' and add the class '.horizontal' to each one of them. The problem is that only the first div matched gets the class. The others are just ignored and don't get it.
$(document).ready(function(){
$("#moldura_slides").addClass("horizontal");
});
This is the page: [URL]

View 3 Replies View Related

JQuery :: Using Hover With Live Function?

Apr 20, 2011

my jquery was intially was

$(document).ready(function () {
$('ul.nav li').hover(
function () {

[code]....

View 4 Replies View Related

JQuery :: Using Live On A Custom Function?

Jan 15, 2011

I have my own custom function:

function callFunction(param1, param2) {
}
this function is called when a user clicks on an image
onClick='callFunction(1,2);'
etc.

How do I apply live to callFunction? The image appears from an ajax call and as such the function doesn't recognise the call. I've used live on my other simple functions, but how would I use it on my custom function? The reason I am using the custom function is because I need to pass parameters to it.

View 1 Replies View Related

JQuery :: Live Function Is Not Working In Case?

Mar 21, 2011

I am very new to jquery live function & i stuck in to the problem. I am using live function to get the ajax response & appending to the div here is my code,

function add_master(module_url, response_target_id, custom_id) {
$('a.addclass').live('click', function() {alert('add');
$(response_target_id).fadeIn('fast');

[code]....

View 4 Replies View Related

JQuery :: Using 'live' And A Dynamic Function Call?

Oct 11, 2010

again I turn this forum as the issue I have is beyond my current knowledge and I have found it impossible to find help on through google.First up, I have some code that puts a keyup event on all text boxes that have a certain string in their ID. That code uses 'live' and looks like this.$("td[id*='tdQuantity'] .field_input ").live('keyup', function() { calculateTotal(); });This one is simple enough. All the input boxes that match that selector call 'calculateTotal()' on keyup. I have code that adds a new dynamic row of items. Hence my use of 'live' above'. However, once it hits calculateTotal() I have it hard coded items on the first row. For example..

if (isNaN($('#tbQuantity_1').val())) {
iQuantity = 1;
$('#tbQuantity_1').val('1');

[code]....

View 4 Replies View Related

JQuery :: Calculation Plugin - How To Use Live Function

Oct 20, 2009

I am currently working on a project where I am using the jQuery Calculation plugin [URL] to do some math functions in a dynamic form, the issue is that when a new set of fields is created the calculation script only pulls data from the ones there when the page loaded, I am fairly certain that what I need to do is use the live function, however I am not very familiar with it and still learning. My jQuery for the plugin is :
$("input[name^=emem]").sum("keyup", "#totalMem");

View 1 Replies View Related

JQuery :: Search Dynamic Control After Binding With Live Function?

May 5, 2011

I have to create a dynamic html block that can hide and show text, anchor tag is used to hide/show the block, which is also dynamically generated, so I have to call anchor's tag click event using live function, but within that click event I have to look up for immediate next div control which will hide/show. my code is somewhat like below I am comment the line of code which is not working

$("a").live("click", function(e) {
var $nextElement = $(this).next("div");//div control is not found here, it is also dynamically generated.
($(this).html() == "[-]") ? $(this).html("[+]") : $(this).html("[-]");

[Code].....

View 4 Replies View Related

JQuery :: Submit Function Not Always Trigger Live Or Bound Handler

Sep 25, 2010

I have this boiled down to the following code: [URL]. I have two text inputs in a form, and a keydown handler to catch the arrow keys. When the focus is lost on an input, it is supposed to call the submit handler on the form. When I use the tab key, it works as expected, and calls my submit handler. However, when I use the arrow keys, it submits the form and goes to the action url, not running the alert in my custom submit handler. It's as if it either loses the bound submit handler or it calls a new default one or something.

View 2 Replies View Related

JQuery :: Body Click Function Stops Other Live Functions From Working?

Oct 26, 2010

When thebody section below iscommented out, I get hello, and when it isn't, I don't !

$("body"
).click(function
(e){
return

[Code]....

Is this a bug, is it an unavoidable aspect of the "live" architecture

View 3 Replies View Related

JQuery :: Function Return - Pull Live Data From Database And Display It In An Alert Box On Sight

Oct 10, 2010

I'm very new to jQuery, only picked it up yesterday, so there is very little I understand at the moment. I have a website on which I would like to display a real time, time-series chart displaying results from a database that is constantly updated. how to pull live data from my database and display it in an alert box on my sight. One of the replies said I should use jquery to achieve this.

[Code]...

View 1 Replies View Related

JQuery :: Firebug Shows The Updated Class Of An Element But Live() Function Takes The Old Class?

Jul 2, 2009

I am new to this discussion but hope you would post reply for my query and encourage me to keep in touch with this discussion. Well here is my problem. I have made an edit in place form in which we can add and remove the elements. I have used jquery.jeditable.mini.js and jquery.duplicate-remove.js plugins for edit in place and add and remove action. I have live() function to access the dynamically ganerated elements like this. $(".addressDiv span").live("mouseover", function(){
clickable function here...

[Code]...

View 1 Replies View Related

JQuery :: AddClass

Jun 1, 2011

.firstButton { background:url('../Images/leftCurve.png') bottom left no-repeat !important; }
.firstButton span { font-size:150px; }

There is a line like the following. $(afterButton).removeClass("firstButton").addClass("firstButton"); afterButton element is not null. But this object can not add a new class. Alert to look at the properties by the method of the object is added to a class. Why not work?

View 2 Replies View Related

JQuery :: Focus AddClass In IE?

Sep 20, 2009

the following works in FF but not in IE 6 nor IE 7

$('#msgsp').addClass('hidden');
$('#eventname').focus(
function() {
$(this).addClass('input_fields_focus');
}
);

that is IE the div #msgsp is not hidden and when focus on the input box #eventname the background color aint changed are there special methods/syntax for IE? are these methods intended to work in IE?

View 1 Replies View Related

JQuery :: IE Does Not Re-render After .addClass()?

Oct 19, 2010

I have a strange problem that occurs in IE 7 and 8 and does not occur in Firefox or Safari.I'm dynamically adding class to a table row on a checkbox selection. A row contains some input fields that get enabled or disabled. If a row is enabled, it gets highlighted using selectedrow class. If it gets disabled, the class is removed:

[Code]...

View 1 Replies View Related

JQuery :: Use AddClass With Variable?

Jul 20, 2011

I'm new using Jquery and I have a problem using addClass, removeClass.

This is the code that I have[code]...

View 7 Replies View Related

JQuery :: AddClass Not Working In Webkit - IE

Dec 7, 2010

I want to add a 'visited' class to a table cell and all of it's siblings if the link in the first td has been visited.

Here is my markup.

I've tried his:

And this:

And the class only gets added/appended to the table cells in FF, not webkit or IE and firebug tells me that the css is fine and would be applied if the class were present.

View 2 Replies View Related

JQuery :: Adding Effects To AddClass?

Aug 2, 2009

I am trying to write a background image swapper, which I have got working. Ideally I would like to add a transition between the classes I am changing.

I am new to jquery, and I thought this would be a simple project to start on, but I just can't get the fade to work. see below for my code:

[Code]...

View 1 Replies View Related

JQuery :: Can't Make AddClass Work?

Mar 9, 2011

I have html code:

<div id="dropdown" class="rMenu">
<ul id="middlemenu" class="rMenu-hor rMenu">
<li><a href="page.html">Page</a></li>

[code]....

View 1 Replies View Related

JQuery :: Handy AddClass Use In .append?

Mar 6, 2010

$('body').append('<div id="mydiv"></div>).addClass('newClass');addClass can be used to add a class to a selector. Take the above example. If the class is added to 'mydiv' instead, not body, this could be handy than writing the two lines:$('body').append('<div id="mydiv"></div>);$('#mydiv').addClass('newClass');

View 4 Replies View Related

JQuery :: Date Is Expired AddClass?

Mar 8, 2011

How can I add an class to my <TR> when the date is expired?

[Code]...

View 3 Replies View Related

JQuery :: Using AddClass To Highlight Errors?

Sep 24, 2009

I have what I'm certain amounts to a CSS misunderstanding on my part. Here's the reduced problem:

CSS
input[type='text'], textarea {
background-color: #2c2c2c;
color: white; }

[Code]....

The problem: The addClass does not affect the styling of #title. Firebug shows .error, but as an empty selector. And, BTW, is this an appropriate way to flag errors -- by adding or removing a class?

View 2 Replies View Related

JQuery :: Selector Not Recognizing AddClass?

Apr 21, 2010

I'm trying to write a cinema seat selection page and I'm hitting a problem with a selector not recognising a 'booked' class that I've just been added via JSON. I wonder if anyone could tell me why it works ok when I hard code the 'booked' class in but not when I do it through jQuery. Should I just do it in PHP??? or is there a way around the problem.

[Code]...

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved