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
ADVERTISEMENT
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
View Related
Feb 18, 2011
I am really new to JS (literally just starting looking into it) and I was wondering if anybody could help me or give any suggestion as to how build a comment box which appear when a user click on the comment button.Now I had a stab at that but my JS skills are still really poor. Here's what I came up with after sometime looking around on the net and getting (or at least trying to) action some suggestions I managed to get here and there:
HTML Code:
<html>
<head>
<style type="text/css">[code]......
View 4 Replies
View Related
Aug 6, 2010
I have a function that dynamically creates links for a photo gallery. The function also produces a larger image as a background image of a div when and thumbnail is clicked on. What I want to do is have a third event, where if the user clicks the enlarged image in the div, the jQuery Fancybox loads an even bigger version of the image being displayed in the div. The problem is that the link for the anchor tag I'm using is created dynamically, and I know that Fancybox parses the HTML when the DOM is ready...unfortunately my function changes the DOM by appending the anchor tag for the full sized image. I need is using the Fancybox's options to specify the href attribute for the plugin.
jQuery:
function gallery(picid, picnum){
var ext = 'jpg';
var fullSize = 'imgs/'+picid+'_full.'+ext;
[Code].....
View 1 Replies
View Related
Dec 19, 2010
I'm relatively new to jQuery, and I'm trying to figure out how to create a restaurant menu, that when you click on an item on this menu, an image and description will show on the page. [URL]I've looked through several plugins but cannot find this exact solution. Can anyone please point me in the right direction?
View 2 Replies
View Related
Nov 7, 2011
I use malsups Cycle plugin a lot as it is very versatile, however when I have a pager with a slider and click through to the next slide (whilst current slide is animating) it jolts to the end of the current slide transition before continuing with the next slide transition. Example: [URL]. Ideally, when you click on the next pager link, (before it has finished sliding), it finishes it's animation and scrolls to the next OR slides from it's current point on the current transition to the end of the next slide.
View 3 Replies
View Related
Sep 9, 2009
I have a problem with my menu. I am trying to add and remove classes when clicking on the main menu links. For instance when on load, the 'Home' is the current tab clicked, but when I click on 'Contact Me' I would like the class current to be removed from 'Home' and added to
'Contact Me' instead.</div>
<div> </div>
<div>The code im using is the one below.</div>[code]....
View 1 Replies
View Related
Jun 10, 2009
I use the live - method to bind a handler to a click-event for all links with class "userDiv"
When I DON'T use this and use instead the "normal" click handler
I can still use the middle Mouse-Button in Firefox to open the link in a new tab without any jquery-stuff
But when I use the live-method (and it would be nice to use it) the middle Mouse-Button behaves like the left one.
View 2 Replies
View Related
Jan 14, 2010
I have all links that is needed to be click on so what I want to do is, after they click all 4 links, it will enable the button. I know that we have to do this in Javascript but I'm stuck.
Example, there 4 links, after they click all links, it will enable the button.
View 3 Replies
View Related
Jul 27, 2009
I'm confused by firebug's output under the tab 'Net' > All:I post this in the JS section, as I'm sure many js coders use firebug and my question pertains to firebug.I have an image which appears several times on my site - the same image each time, just displayed in different places.For each time the image is displayed, I see a separate call to fetch it from the server, with info on 'Queuing, waiting for response, receiving data' etc, all with the number of milliseconds shown.It looks like it's being downloaded multiple times rather than only once.
View 2 Replies
View Related
May 21, 2009
. I have a problem where I designed my web page project and eventually it must contain a background song that will continuously play even clicking the links/pages.
View 5 Replies
View Related
Dec 10, 2010
Automatically submit a form using .live()?
View 6 Replies
View Related
Aug 22, 2011
I`m trying to incorporate live [URL].. and i`m having a small problem that bothers me at night: all works great but the validation is made per total not field by field like is made in the link above .So i made a validation for email and username on the first field and name on the second if i enter the corect username and email it shows like is incorect only after i enter the name on the second field all other fields validate.So if i have a form with 6 field i have to get to the last one to show the user that all is completed ok.
[Code]...
View 1 Replies
View Related
May 3, 2010
I have a form with about 10 fields, and the action is sent to a php file which processes the form. Now, I also like to use a Thickbox such that the user can preview the page before actually submitting it to the process.php. That means, I have one submit button and one href, which href links to an iFrame thickbox to preview the page. My problem is that I don't know how to obtain the input values in the iFrame, without user clicking on submit (rather i want to get the values through href). something like the preview on this forum, except I want it on thickbox.
View 1 Replies
View Related
Oct 21, 2010
I am having some issues with a form that has "name" "email" "address" text field the a comment section that has been pre filled with the followingI <name> of <address> blah blah blah blah blah blahblah blah blahblah blah blahblah blah blahSigned<name><address>Now my question is how do i get the form (made in html) pull what the user types in the text field and make it get added to the comment section of the form where the <name> <address> is required.Once filled out it is emailed to me.
View 6 Replies
View Related
Nov 26, 2011
I designed a form having ten fields, will it be possible to have a jquery function that will make all the values in the form field to be displayed in a separate div outside the form by click of a button or a link?
View 3 Replies
View Related
Mar 25, 2009
The trouble is, is that some pages are very long and some are very short, so using offsetTop is obviously not bringing the form into full view ;-( Still keeping all the functions detailed in the code below, how would you adjust the code to achieve the aim of always showing the form, when clicking on the button to show the form, regardless of how long or short the page is please?
View 4 Replies
View Related
Oct 12, 2009
I am using jQuery and blockUI to prevent the user from submitting a form twice by double clicking on the interface: This is in my global js file and is called on every pages
document.ready:
$('form').submit(function(){$.blockUI({message:'', overlayCSS:
{opacity:0.2}})});
This was working really well, but if I have validation on one of the form submits that returns false, I of course want to unblock the UI.
View 1 Replies
View Related
Dec 20, 2010
I wonder if there's any chance to get the parent's ID of an html comment.
Let's say I have the following comment inside the DOM[code]...
And I would like to know where is it contained asking for it literally.
I have tried with :contains("<!--this is a comment-->") but contains doesn't seems to support comments.
View 1 Replies
View Related
Dec 21, 2010
I have several comments embedded in my website and I would like to be able to get the ID or the Jquery object refrence of the parent in which they are contained, for example, in the following code I would like to get the ID "container" just by locating the html comment as a string within the page[code]...
View 1 Replies
View Related
Aug 3, 2011
I'm using PHP in my website, and I don't know how to allowadding comment without refreshing the page to the user(it will appear without refresh)
View 1 Replies
View Related
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
Nov 15, 2010
It invovles changing the html using jQuery when the browser is less than IE9
I was messing with the .html() jQueryfunctionthat Ihaveused before and was having some problems With this code, it runs in all browsers:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
[Code]....
View 1 Replies
View Related
Jul 23, 2005
When the user type something in text box, and press enter, it will submit the form data to test2.jsp, even without pressing submit form button. This is not what I want, I want to submit the form only when the user press the submit button.....
View 1 Replies
View Related
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
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