jquery

jquery: simple image preloader + onload

hi all,, i'm trying to make a simple image-preloader for just ONE image. it should load an image and - if finished - fire an event for displaying it. what's the simplest method to do this? i only know the pure javascript solution, like document.createElement("img") - but what's the best method using jquery? what i've got so far (but d...

Javascript ouside public_html?

Is there any way/reason to keep your js/jQuery ouside public_html? Are there security benefits? ...

Javascript: Object's this.var inside jQuery method

Hi, I can't figure this one out: I have a function, e.g. function test () { this.rating = 0; $j('#star_rating a').click(function() { alert(this.rating); }); } var foo = new test(); On click it alerts "undefined". What is wrong? Please help. ...

swapping out an image when selector is clicked using jquery

Hello guys, I have an FAQ and would like to attach an image to the right of the question that tells the person to close if open and open if closed. This is what I have: $('.header-person').click(function() { $(this).next('.entry').slideToggle("fast") return false; }); I currently have the two images next to the question like...

restrict child multiple select based on multiple select of parent with jquery

I need to create an interface that upon selection of a parent multi select, it updates a child multi select of options. It is intended that the parent multi select can have none, one or many options selected and the child element displays a union of items that both parents have (or falls back to all items). Take for example: When pare...

Mod or 33% function regarding jQuery Progressbar update to 100%

How might one handle making a progressbar update to 100% based on having one or more items from all 3 groups? For instance if I have 20 fruits, 0 grains, and 2 vegetables, it should show 66/67%. If I have 1 or more items from each group, show 100%; and having only 1 or more of 1 group should show 33/34% complete. I'm not sure if I sho...

How to optimize CLASS function in jquery

I'm profiling JavaScript using dynaTrace AJAX edition. According to the tool's "Hot Spots", the following jQuery method is using the majority of execution time: CLASS(*, *, undefined, *, undefined, false): false ...it has over 700 invocations on my page. What is this call and how can I optimize it? I'm using jQuery version 1.4.2. T...

give name and value to jqurey UI dialog button...

Hi, i want to give a name and value to the default button in UI dialog. how can i do that ? i would like to give to submit button a value and name! $("#dialog").dialog({ bgiframe: true, autoOpen: false, height: 150, width: 600, modal: true, buttons: { Submit: function() { document.getEle...

jQuery steals click from children

Say i have <h3> some text <a href="google.com">google</a> </h3> I want to attach a click event to the h3 $("h3").click(function(){ $(this).slideDown(); return false; }); but I also want to preserve the clicking on the actual link. Is there a way to do this with jQuery? Thanks! ...

quickSearch jQuery plug-in - Handling Live Content?

Hi! I'm using the quickSearch jQuery plug-in: http://lomalogue.com/jquery/quicksearch/ The reason it's not working currently in my app, is that while my search box remains constant, the table does not... It's a web app, and the table changes. Problem is the QuickSearch plugin will only search with the first table, if I AJAX in new tab...

Selecting an element after the currently matched Element with jQuery?

I have HTML like this: <div id="Div1">...</div> <div class="someClass">...</div> <div id="Div2">...</div> <div class="someClass">...</div> <div id="Div3">...</div> <div class="someClass">...</div> So I have unique DIVs but also some that are indistinguishable from each other. I want to remove a div and the one below it, for example I ...

JQuery .load() callback function

I've seen lots of questions and solutions to problems like this but nothing has worked for me. I have this: function() { $("#bdiv").load("bosses.php #icc10n",function(){ return $("#bdiv").html(); }); } But it's not working. To clarify, I want to load content into #bdiv and then return the contents of #bdiv. But it seem...

jQuery - Two dialog boxes, only one click event is working

I'm using ASP.NET and jQuery. I have two dialog boxes, each of which have a button with a click event. The form started with one, and everything worked fine. You could enter a fax number, click a button, and stuff would happen. Adding in the second dialog box caused problems. The button in the first one just stopped working, but t...

How to exclude focus change with JQuery .live change?

I've got a dirty text variable I need to set on a text change, radio button change or dropdownlist change in a form. Unfortunately the generic: $(':input').live('change',function(){... }) also detects a change in focus... thus making a false positive for dirty text. ...

get iframe's document variable from within jquery plugin?

Hello, I create a new iframe, append it to body, and then try to get its 'document' variable, like this: var $iframe = $( "<iframe name='my-frame'>" ); $iframe.appendTo( $("body") ); var doc = null; if($.browser.msie){ doc = window.frames["my-frame"].document; // 'access denied' in IE } else { doc = $iframe[0].contentWindow.d...

How can we execute Unit Tests against DOM manipulation?

The introduction to QUnit over at netTuts.com spawns an interesting exchange (never resolved) over how to apply unit tests against actions that manipulate the DOM. The following quote (Alex York) gets to the crux: What would be nice is that if you had a function like this: function add(a, b) { var result = a + b; $(“input#...

Convert dropdowns to radio buttons w/o modifying HTML

So this is sort of an exceptional case situation - I have a plugin that I can't modify for contractual reasons. It displays a set of drop downs and I need it to display a set of radio buttons instead. Is there a js/jquery method for converting dropdowns to radio buttons w/o changing the HTML. Remember, I can add stuff - I just can modify...

Conditional change (if/then) based on css property in jquery

I have several images: <img class="photo" src="{{ img.url_small }} /> <img class="photo" src="{{ img.url_small }} /> <img class="photo" src="{{ img.url_small }} /> I'm trying to change the border color when the user hovers over the image or clicks on it: $(".photo").click(function() { $(".photo").css({"background":"white"}); $(...

jquery theme builder question

How do I initialize a button as an icon using the JQuery themeroller? I dont want text next to an icon, I just want an icon, and I want to switch between two icons when clicking on it. ...

Barcode web site interaction

I'm in the process of designing a web application and I'm thinking about incorporating some barcode reading to facilitate data input. Let's suppose I have a list of tasks a courier needs to do. I would like to print something similar to the following page: +----------------------------------------------------------------------+ | Task...