Simplify code
Hi everyone, I am wondering whether I can simplify my code any further. I am creating a plugin where you call it as so: $('#csTriggers, #csTargets').switchContent(); In the plugin, I have the following code: var triggerContainer; var targetContainer; this.each(function() { if ($(this).attr('id') == 'csTargets') { targetContainer = $(this); } else if ($(this).attr('id') == 'csTriggers') { triggerContainer = $(this); } }); I have to do this rather than var targetContainer= this[0]. If I change the
[jQuery] Select box .show problem
Hi , I'm just trying jQuery out for the first time... Is this a bug in jQuery or am I doing something wrong? I am trying to chain together a bunch of drop down select boxes. Whenever I just use .hide() and .show() it works fine. But if I use .show("slow") it adds big gaps between some of the select boxes. I get the same result with both FF, IE and Safari. Example code is below. Any ideas? Thanks <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ TR/html4/strict.dtd"> <html> <head>
sorting problem, resort the div id after sort
hi everybody!! im sorry for disturbing you! im learning jquery at the moment (and english ...*g*, no clue where i suck more...) and now ive got following problem: i make use of the jquery ui and there specially i use the sortable thingy... so now the problem: im trying to sort some divs. after sorting i want to sort the order of the divs in a new way (simple from 0 - x). so far my code looks like that: $('#sort').sortable({ placeholder: 'placeHolder', handle: '.handle', update:
[jQuery] Request: build hoverFlow in jquery core
Hey, The biggest issue i always had with jquery was that queue build up stuff. Now we have the hoverFlow plugin to fix that: http://www.2meter3.de/code/hoverFlow/index.html But i was wondering.. shouldn't this be part of the core? like for example that you can say to the animate function to run once and not build up the queue? Also the ability hoverFlow provides seems to be something that really should be in the core because everyone working with effects will probably need it at some point in time.
trouble shoot jquery issue
Hi, I had a working jquery contact form on my website. This is the form: http://www.queness.com/post/160/create- ... ith-jquery I added a jquery livesearch to the website and my contact form stopped working. Both use the same jquery library in my header. How/where can I go to troubleshoot something like that. I tried to move the livesearch.js and the js needed for the form around in the header but that didnt work. I am a front end designer and have no experience with coding other than html/css. any
[jQuery] Drag&Drop Plugin that will allow users drop information on a form to autocomplete
I have a simple shopping website. Buyers first need to register to purchase an item. While a buyer proceeds through steps shipping & payment etc... he is allowed to save some of the information entered for future use. For instance, John Doe puchased xyz item and while proceeding through steps he saved the shipping address information for future use. Next time John Doe passes through steps, on shipping address information he will see the saved address on the right side in a box. But he needs to re-enter
[jQuery] Help required on JQuery Autocomplete plugin
Hey guyz need some help with JQuery. I have a requirement in my project to provide an autocomplete feature for a textBox like the one recently applied on google. I need to fetch data on each keystroke so I am calling a JQuery fuction on keypress. The problem is the Autocomplete feature gets triggered on mouse click in the textBox and not on keypress. I will attach the code snippet for a better understanding of the problem which goes like this $(document).keypress( function(){ lastKey = String.fromCharCode(window.event.keyCode);
tabTrigger not working in jQuery Tabs
Hi... i am stuck with a problem of tabtrigger in jquery tabs. When i enter a numeric i get that tab active when the page loads, but when i used a variable to trigger the active tab, that value is not taken. #tabTrigger is a hidden input where i pass value based on the user action..... Please help... $(function() { var activeTab = $('#tabTrigger').val(); $('#container-1').tabs(activeTab); $('#container-1').triggerTab(activeTab); //$('#container-1').triggerTab(2); when using this method the
jquery and strings
there is a way to know how much X elements are appearing inside a string? i tried this one: $(msg).find('img').length but no success
[jQuery] Selectors only matching first element
Hi all, I need some help here. I'm still pretty new to jQuery and Javascript in general, so apologies if this is a basic question. All I am trying to do is a simple "select all" checkbox script. The problem is, no matter what I seem to do, only the first element is matched. $("input:checkbox").attr("checked", true); checks the first box only. Same with: $("input:checkbox").each(... I even tried copying this script directly from the jQuery documentation page: $("div").css("border","9px solid red");
[jQuery] Drag and drop prob
Hallow fellows. Recently i installed Dragg & Dropp plugins for my jquery, and is working acually its brilliant i love it! But something is missing, i got my drop zone aswell as i got my drag element, these 2 elements is of same size. i got revert: 'invalid' So that you may only drop in drop zones. But when you drop, i want it to fit my dropp element, so that my dragg element fills my dropp, but i just don't seem to be able to find a command which will do it. Been googling reading manuals, and nothing
[jQuery] hover + inside elements
Hi, I have a layout with 4 collumn divs. When the mouse hovers over each collumn, a simple fadein is performed on another element. Now what happens is, when i move over another element INSIDE a collumn div (a <h2> for instance), the same fadein runs again... Am I doing something wrong with the selectors ? Here's a piece of code: $(document).ready(function() { var sectionSpeed = 250; $("#section-c").hover( function() { $("#icon-c").fadeIn(sectionSpeed); }, function() { $("#icon-c").fadeOut(sectionSpeed);
[jQuery] ui sortable - cancel action if list is too long
I have few lists with ui sortable/droppable and I want to have let say max 4 elements in one. So: $("ul[id^='sortable']").sortable({ connectWith: '.user-list', dropOnEmpty: true }) $(".accept-drop").droppable({ drop: function(event, ui) { //some code if($('#sortable'+new_id+" li").size()>4) { //DO SOMETHING TO STOP SORTABLE } }); What code should be there? I've tried to change class to .disabled but it blocks moving. $('#sortable'+new_id).sortable("cancel");
[jQuery] Dragg and dropp problem! :/
Hallow fellows. Recently i installed Dragg & Dropp plugins for my jquery, and is working acually its brilliant i love it! But something is missing, i got my drop zone aswell as i got my drag element, these 2 elements is of same size. i got revert: 'invalid' So that you may only drop in drop zones. But when you drop, i want it to fit my dropp element, so that my dragg element fills my dropp, but i just don't seem to be able to find a command which will do it. Been googling reading manuals, and nothing
[jQuery] Dragg and dropp problem! :/
Hallow fellows. Recently i installed Dragg & Dropp plugins for my jquery, and is working acually its brilliant i love it! But something is missing, i got my drop zone aswell as i got my drag element, these 2 elements is of same size. i got revert: 'invalid' So that you may only drop in drop zones. But when you drop, i want it to fit my dropp element, so that my dragg element fills my dropp, but i just don't seem to be able to find a command which will do it. Been googling reading manuals, and nothing
copy content from a form field to another with jquery
hi queries...i use a from in wordpress (tdo miniform) and in this form i copy the content of a field into another: $(document).ready(function(){ $("input#same").click(function(){ if ($("input#same").is(':checked')) { // Checked, copy values $("input#content_title").val($("input#customfields-textfield-1").val()); } else { //
[jQuery] can someone translate this syntax ?
(function($) { $.fn.jCarouselLite = function(o) { o = $.extend({ btnPrev: null, btnNext: null, btnGo: null, mouseWheel: false, auto: null, speed: 200, easing: null, vertical: false, circular: true, visible: 3, start: 0, scroll: 1, beforeStart: null, afterEnd: null }, o || {}); return this.each(function() { var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width"; var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible; }); }; })(jQuery);
slide down starts late!!!
Hello all, I have a jquery slidedown effect which id triggeref onchange of dropdown But the slide down effect starts a few seconds after the option is change. It delays Can anyone tell me what could be the reason. Thanks Karamvir
JSON- PHP generated JS-file question
So i'm back again. The idea is still to type in a code, and automatically show the price of that item. I'm getting close and i have the following: <script language="javascript" type="text/javascript"> $(function() { $("input").next("#prijs").hide(); $("#naam").blur(function () { $.getJSON("producten.js", function(json) { /* Parse JSON objects */ jJSON["prijs"] = (function() { response = { values:[],
[jQuery] Stack Overflow at line 0
I "occasionally" get this error in IE8 when refreshing a page. The debugger is locked out making it difficult to identity the cause. There's a snippet of code I am using to preload images which when I borrowed it, mentioned this problem. I've posted it below. Any suggestions on how this code might be involved with the problem and how it might be resolved? $(window).bind('load', function() { // sequentially preload quiz images after page loads var preload = []; for (var i=0; i< aQL; i++) {
[jQuery] Named and anomymous functions
o.fnTest = function(){ alert('Hello World') } o.fnTest = function fnTest(){ alert('Hello World') } both seem to assign the function to o.fnTest. Most of the plugin libraries I've seen use the anomymous function assignment. The latter (a named, not anomymous function in FireBug) is easier to work with. Stack calls in Firebug show up with named, not anomymous functions. Are anomymous functions preferred because they save a few bytes of source code filesize or does the latter do something unwanted?
check the response of a php function
I'm stuck!:( When I click on a link I have this event: $.ajax({type: "POST", url: "/req.php", asynchronous: false, dataType: "xml", data: "jQuery=1"+ "&op=attivaProva"+ "&modulo=statistiche", success: function(risultato){ if (risultato) { jAlert('Attivazione eseguita con successo', 'Complimenti!', function(){ window.location.reload();
[jQuery] ui sortable - cancel action if list is too long
I have few lists with ui sortable/droppable and I want to have let say max 4 elements in one. So: $("ul[id^='sortable']").sortable({ connectWith: '.user-list', dropOnEmpty: true }) $(".accept-drop").droppable({ drop: function(event, ui) { //some code if($('#sortable'+new_id+" li").size()>4) { //DO SOMETHING TO STOP SORTABLE } }); What code should be there? I've tried to change class to .disabled but it blocks moving. $('#sortable'+new_id).sortable("cancel");
[jQuery] autocomplete
I am using the jQuery autocomplete plugin (http://bassistance.de/ jquery-plugins/jquery-plugin-autocomplete) it works fine and has me made a happier person as a whole. I am using the plugin in "remote-mode" meaning that I fetch a seperated list from my server. The problem now is that this server uses basic authentication and whenever I start typing I get prompted for the username and password, which is quite annoying. The jQuery Form Plugin for example allows to send username and password for authentication,
[jQuery] Horizontal Superfish with 100% width
Hi, i've made a horizontal Superfish menu which fills the containing div entirely, based on the description given here: http://dizque.lacalabaza.net/temp/full-width-navigation-bar-with-css.html Basically that is: #menu { width: 100%; float: left; display: table;} #menu > ul { display: table-row; } #menu > ul > li { display: table-cell; min-width: 20%; } However, this causes the effect of the Supersubs plugin to stop working. Is there a way of providing a dynamic submenu width when having a "full
Newbie Help
Hi, How can I shorten this structure? The things I am passing into it are the numerics 1,2,3,4 etc which get passed on to #p and page= basically I would want to replace it as #p + $variable page= +$variable Wanted to learn how to shorten this code out $("#p1").click(function(){ $('#b').fadeOut(5000); $("#b").load("/page.php"); $('#b').fadeIn('slow'); }); $("#p2").click(function(){ $('#b').fadeOut(5000); $("#b").load("/page.php?page=2"); $('#b').fadeIn('slow'); });
[jQuery] Finding elements - difference between Firefox and IE
Hello, I am new to jQuery; I am trying to write a script that looks for empty fields in a table, and if it finds them to remove the empty <div> elements. The following script works fine on Firefox, but not on IE. What is the problem? any advise for getting this to work? var fieldName = "#orgPerson0"; content = jQuery.trim($(fieldName + " :eq(3)").text()); if (content == "") { console.log("0. Content is empty"); $(fieldName + " :eq(1)").empty(); $(fieldName + "
[jQuery] Process E-mails From Home, Earn $1050 Per Week
Process E-mails From Home, Earn $1050 Per Week Join Now To Earn http://createfreeweb.googlepages.com/internet-jobs
[jQuery] jQuery Leaving Unwanted Whitespace On remove
Hello, So I have a problem and no solution for it. On my website I use jQuery remove to take divs off of the screen. The problem is I do this a lot (the site is constantly putting divs on and off the screen) and everytime I use remove it is leaving whitespace. After a couple of thousand times of doing this, I end up with a lot of whitespace that slows my website down. Does anyone have a solution for this, I was thinking the following: 1) Figure out how to use remove, such that is doesn't leave whitespace.
[jQuery] HELP: FireFox page reload bug using jQuery for deferred loading (using html() function)
Hi all, To enhance user experience on my site, I've moved a few page elements (well, the ads...) to the end of the page (in a hidden div) and when the page is loaded the content of such divs are copied to their appropriate location on the page. This makes the content load much faster and thus not delay the user. So what I did works perfectly with IE/Opera but th FireFox is causes the page to try and reload, which it never succeeds to and so we're stuck with a blank page. So yes, the problem is that
[jQuery] HELP: FireFox page reload bug using jQuery for deferred loading (using html() function)
Hi all, To enhance user experience on my site, I've moved a few page elements (well, the ads...) to the end of the page (in a hidden div) and when the page is loaded the content of such divs are copied to their appropriate location on the page. This makes the content load much faster and thus not delay the user. So what I did works perfectly with IE/Opera but th FireFox is causes the page to try and reload, which it never succeeds to and so we're stuck with a blank page. So yes, the problem is that
[jQuery] jQuery powering the new Library of Congress Metasearch App
Hey jQuery Community, I wanted to announce another feather in jQuery's hat. The new Library of Congress Metasearch application was quietly released today and the interface is entirely driven with jquery and jquery-claypool. It's a single url app that is all ajax after that so make sure you turn off firebug unless you want a big performance hit. cheers to the jQ Links: <a href="http://www.loc.gov/">http://www.loc.gov/</a> This is the general Library of Congress site. To access the app, just use
[jQuery] Looking to select and morph a class within an id.
The structure of my page goes <div id="CLVMajorModule> <div class="majorModule"> <div class="propImageContainer"> </div> </div> </div> <div id="PLVMajorModule> <div class="majorModule"> <div class="propImageContainer"> </div> </div> </div> (poop, the images are being rendered, the code is img src="" alt="" width="120" height="90" class="propImg" ) I am trying to alter the src of the img element in the first div with id of CLVMajorModule. I am a total newb, and am thus not getting it. Why is this
[jQuery] Bind unbind click
OK i managed to prevent specific links from being clicked. But once the function is complete i want to enable the links again. But i keep getting H not defined error. Below is what I am using. But the links still remain unclick able Initial function: $('a[class^="edit_"]').click(function(){ var url_id = $(this).attr('href'); var e = $(this).attr('class'); var x = $(this).attr('id').split('_'); var y = x[0]; var z = x[1]; //alert(e); $('a[class^="edit_"]').unbind('click'); $('a[class^="edit_"]').fadeTo('slow'
[jQuery] Selector not question
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=us-ascii" http-equiv=Content-Type> <META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD> <BODY> <DIV><FONT size=2 face="Trebuchet MS"><SPAN class=441553900-05062009>I am trying to disable all links except for the one clicked.</SPAN></FONT></DIV> <DIV><FONT size=2 face="Trebuchet MS"><SPAN class=441553900-05062009></SPAN></FONT> </DIV> <DIV><FONT size=2 face="Trebuchet MS"><SPAN class=441553900-05062009>$('a[class^="edit_"]').click(function(){<BR> var
[jQuery] Rebinding .one() on ajax callback
I'd like to make my buttons clickable once so I use the .one() method to set up their binding. This way users don't click a form's button more than once while it is submitting. I thought this would be easy to do but I cant seem to rebind the button during the error event. I was hoping I could just call .one() again but it does not seem to work in all browsers. simplified example below... $("#mybutton").one("click",null,callajax); var callajax = function(e){ $.ajax({ success: function(data){console.log("yay!");},
[jQuery] toggle with a check box to disable/enable inputs
I want to in a form be bale to enable or disable portions of the form when the user clicks ona check box. I have tried two different ways but neither seems to work... //the first does not let me even click the check box $('#regular').toggle( function() { $('#regular-updates-options').removeAttr('disabled'); }, function() { $('#regular-updates-options').attr('disabled', 'disabled'); } ); //this one allows me to click the box but nothing else
[jQuery] Form Plugin and Validation, I am totally lost even after doing the research.
I am new to jQuery and am having trouble understanding how to use the Form Plugin with the Validation Plugin. I can get both plugins to work separately but not together. Here is my code for the form plugin which works great - $('#myForm').ajaxForm(function() { $.get('tasks.cfm',{},function(data){ $('#newTasks').html(data); }) }); After looking at the sample on the Validation Plugin page I have the following code which does not work the way I want it
[jQuery] Selector help
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=us-ascii" http-equiv=Content-Type> <META name=GENERATOR content="MSHTML 8.00.6001.18702"></HEAD> <BODY> <DIV><FONT size=2 face="Trebuchet MS"><SPAN class=572164017-04062009>I am cleaning up some html code and originally i had</SPAN></FONT></DIV> <DIV><FONT size=2 face="Trebuchet MS"><SPAN class=572164017-04062009><li><BR> <div class="loading" id="loading_profile"></div><BR> <div id="profile"><BR>
[jQuery] Superfish menu - how do I get the drop downs to fit the titles?
Right now this is what I am getting: http://www.createyourimpact.com/clients/msc/ Go to programs for example - how do I get the drop down boxes to fit? Thanks!
Next Page