[jQuery] Re: Replace element by another

2009-05-01 Thread Hamish Campbell
> I know how to switch from an element "a" to another "b", but i can't > find a way to "re-switch" from "b" to "a". You might want to explain the problem better, with a working script. That script will replace every clicked link with the letter b - I doubt that is the intended operation. If you

[jQuery] Re: jquery forms with ajax responses

2007-12-18 Thread Hamish Campbell
I think you need to add "return false;" to the end of your submit function. This will tell the browser not to redirect to "addShift.php" after running your function. You should make the action page the 'non-ajax' alternative, so if the function doesn't execute it can continue anyway. On Dec 18,

[jQuery] Re: jquery forms with ajax responses

2007-12-18 Thread Hamish Campbell
"return false;" needs to be the _last_ thing it does, so move it to the end of the function.. otherwise it hits return and quits the function without doing anythig else. eg: $("#addShiftForm").submit(function() { // do some stuff return false; }); On Dec 19, 7:54 am, pedalpete <[EMAIL

[jQuery] Re: check if an id exists

2007-12-26 Thread Hamish Campbell
extendify! $(document).ready(function() { jQuery.fn.exists = function() { return ( this.is('*') ) } } }); On Dec 27, 10:28 am, "Michael Geary" <[EMAIL PROTECTED]> wrote: > It's funny, if I saw: > > if( $('#id').is('*') ) { ... } > > I would have no

[jQuery] Re: label fires click function twice

2007-12-26 Thread Hamish Campbell
I've seen the same behaviour outside of jQuery - something to do with the way 'for' sends events to the target element. Can't remember how/if I fixed it, but you could ditch the label and use jQuery to emulate the label functionality. Not a bad option considering not all browsers support labels c

[jQuery] Re: FadeIn on $(document).ready flicker

2007-12-26 Thread Hamish Campbell
Using FF2, FF3b2, IE7 and IE6 I don't get the flicker (XP SP2, 1280x1024, P4 3.2Ghz). Do you have a demo? Maybe you're running lots of other code first? On Dec 27, 10:51 am, Jeroen <[EMAIL PROTECTED]> wrote: > I'm using jQuery on my new photo blog. I am fading in the image when > the dom has load

[jQuery] Re: check if an id exists

2007-12-28 Thread Hamish Campbell
In the end, it isn't in the spirit of things to add a core function "$ ('#someid').exists()" when "$('#someid').is('*')" happens to do the job already (and it's shorter too!). When you're minifying to 10kb, you don't want redundancy. It might sound strange, but (for me) it is actually pretty rar

[jQuery] Re: Manipulating elements with a click

2008-01-06 Thread Hamish Campbell
Theres lots of ways to do it, eg: $(document).ready(function() { $('ul#content li a').click(function() { // binds a function to every link in every list object in the ul called content. $('ul#content li').removeClass('active').addClass('inactive'); // removes the class '

[jQuery] Re: Not recognizing multiple classes

2008-01-06 Thread Hamish Campbell
What happens if you change: $("p[class='"+whichClass+"']").show();}); to $("p.'"+whichClass+"']").show();}); ? Or what about * selector: http://docs.jquery.com/Selectors/attributeContains#attributevalue //show any straggling, hidden p's with the right class $("p[

[jQuery] Re: How to set up a callback on a function I've made?

2008-01-08 Thread Hamish Campbell
To clarify what Cesar said, the loading function _has_ finished executing (ie, modifying the DOM). You need to preload any images first so they don't have download it when the function fires. eg: http://www.ilovejackdaniels.com/css/preloading-images-with-css/ On Jan 9, 8:40 am, "Cesar Iduarte"

[jQuery] Pretty Horizontal Rules with jQuery

2008-01-09 Thread Hamish Campbell
Hi all, Thought I'd share a little piece of code I whipped up this morning. This turns hr elements into pretty div based dividers. In action here: http://www.deft.co.nz Turn js on and off and compare! In the HTML: In the JS: $(document).ready(function(){ $('hr').each(function() { v

[jQuery] Re: :not and :headers

2008-01-13 Thread Hamish Campbell
Haven't tried it, but I think the issue is you're apply it to _everything_ (*) that is not a header. That means the body, all paragraphs, divs, spans etc. Ie, if you haven't specified a font for headers explicitly, the headers will inherit the font from the body (or a containing div, span, a etc).

[jQuery] Re: simple newbie js function problem...

2008-01-15 Thread Hamish Campbell
The function 'force' belongs to the document.ready call, so as soon as that's done 'force' is destroyed. If you put it outside of the document.ready, the function exists globally for all javascript in the page. On Jan 16, 9:13 am, tlob <[EMAIL PROTECTED]> wrote: > hm... why? can you explain me i

[jQuery] Re: simple newbie js function problem...

2008-01-15 Thread Hamish Campbell
orce()',500); }); }); Now the variable 'force' is global, the function will stick after document.ready has completed and your code should work. Hope this helps everyone out with other scoping issues :D On Jan 16, 9:56 am, Hamish Campbell <[EMAIL PROTECTED]> wrote: > T

[jQuery] Re: Loading dynamic JS libraries with jQuery

2008-01-16 Thread Hamish Campbell
What is the output when you fire this: function loadJavascript(scriptFile) { var scriptsPath; // Builds the correct scripts path scriptsPath = $('script').attr('src'); scriptsPath = scriptsPath.replace(/\w+\.js$/, ''); $.getScript(scriptsPath + scriptFile

[jQuery] Re: jmaps - callback function problem

2008-01-16 Thread Hamish Campbell
It's a great plugin - I'm using it (well, jmap2 actually) at isat.deft.co.nz to integrate twitter and gmaps (currently a proof of concept page only). I believe I know where you're going wrong. By default, searchAddress performs actions on the current map, rather than returning something useful. H

[jQuery] Re: how can a text field be hidden based on condition

2008-01-16 Thread Hamish Campbell
To make it check on change: $('#mySelectId').change(function(){ if($(this).val().indexOf('someValue') != -1) $('#someElement').hide(); }); On Jan 16, 12:30 pm, Wizzud <[EMAIL PROTECTED]> wrote: > var txt = $('theSelect :selected').text(); > if(txt == 'cat' || txt.indexOf('c')==0 || ...te

[jQuery] Re: Still working out "drop-down div menu"...

2008-01-16 Thread Hamish Campbell
The cause of problem 1 and 3 is that your functions are all nested inside each other. You don't really need to check if they're visible or not so you can dump the 'visible' checks. You could also change it so rather than sliding up when you mouse out of the heading, it slides when you mouseout of

[jQuery] Re: jmaps - callback function problem

2008-01-17 Thread Hamish Campbell
p.GGeoCache, >returntype: 'object', >addMarker:false > > and do an alert($address) I actually get a HTML div Object, not a data > array. Whats going on? This looks like it should be returning an array. > > On Jan 16,

[jQuery] Re: simple newbie js function problem...

2008-01-17 Thread Hamish Campbell
Ah so, you learn something new everyday! On Jan 16, 5:34 pm, fuzziman <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > Remember that variables declared within functions only exist for that > > function. > > Not really... > > As others mentioned, the crux of the problem is because setIn

[jQuery] Re: Reverse IP Lookup

2008-01-18 Thread Hamish Campbell
Easiest way might be to purchase an IP lookup database and did it yourself. On Jan 18, 4:22 pm, timothytoe <[EMAIL PROTECTED]> wrote: > It's reasonably easy to get it down to a zipcode. But beyond that I > don't think it's possible. IPs are way too dynamic. > > --tt > > On Jan 17, 6:12 pm, "Gle

[jQuery] Re: ajax load, url variable question.

2008-01-21 Thread Hamish Campbell
Here's one way - it's possible, but messy, as you have to use eval. As far as I can see you can't have a variable variable name, unless you're evaluating on the fly. For example: var a = { b: 'x' }; var c = { a.b: 123 }; alert(c.x); // hopefully we'll get "123" .. doesn't work, because a.b is

[jQuery] Re: filter selects and get value...how?

2008-01-21 Thread Hamish Campbell
Can you show the source of the selects, because the description is a little confusing. You have array of selects? So multiple selects, but only one has a value at any one time? Or do you have a multi-selection select and hence you're trying to find the _options_ that are selected? On Jan 22, 11:4

[jQuery] Re: filter selects and get value...how?

2008-01-22 Thread Hamish Campbell
;).each(function(){ > var $inputs = $('input',this); > var qty = > $inputs.filter("[name='qty[]']").children("option:selected").attr("value"); > ... > > } > > On Jan 22, 12:03 am, Hamish Campbell <[EMAIL PROTECTED]> wrote: >

[jQuery] Re: A Beginner Question

2008-01-22 Thread Hamish Campbell
Here's how you do it (tested and working): Item Group A Item 1 Item 2 Item Group B Item 1 Item 2 Item 3 $(document).ready(function() { $('dt').click(function() { var obj = $(this).next(); while (obj.is('dd')) { obj.toggle(); o

[jQuery] Re: A Beginner Question

2008-01-22 Thread Hamish Campbell
nextAll behaves differently from nextUntil On Jan 23, 12:34 pm, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: > Karl Swedberg schrieb: > > > Hi Volkan, > > > You could use John Resig's .nextUntil() method. > > Not 100% sure, but afaik nextUntil is included in jQuery 1.2 as > nextAll:http://docs.jque

[jQuery] Re: Q: on handling GET JSON

2008-01-22 Thread Hamish Campbell
> This code suggests to me that jQuery expects such data to come only from > relative URLs, but I don't understand what justifies this expectation. security? Prevent XSS attacks most likely.

[jQuery] Re: Google map plugin?

2008-01-29 Thread Hamish Campbell
I've used jmap2 a bit. It's really nice to have a jQuery-like way of playing with maps (as well as geocoding, etc) - but as was said before, hard to say if it is worth it for the added overhead and restrictions it places on your code. That said, I think there is room for a more extensive jQuery s

[jQuery] Re: File inputs

2008-01-29 Thread Hamish Campbell
Some code would be useful - you've said that .click() doesn't work in FF, but it probably isn't the .click() bit that isn't working. One suggestion (untested) is that you include both the normal button and the new image, but hide the image with CSS by default. This means that if JS is disabled, t

[jQuery] Re: File inputs

2008-01-29 Thread Hamish Campbell
Actually, I just went a re-read the thread and I have NO idea what it is you're trying to achieve. On Jan 30, 8:01 am, "Steffan A. Cline" <[EMAIL PROTECTED]> wrote: > on 1/29/08 11:57 AM, Mika Tuupola at [EMAIL PROTECTED] wrote: > > > > > > > > > On Jan 29, 2008, at 7:08 PM, Steffan A. Cline wrot

[jQuery] Re: jQuery API extension for Dreamweaver

2008-01-29 Thread Hamish Campbell
Wow, that is awesome. Thanks! On Jan 5, 2:08 pm, Chris Charlton <[EMAIL PROTECTED]> wrote: > BETA:http://xtnd.us/download/dreamweaver/jquery/ > > Works with Dreamweaver MX (6), 7, 8, and CS3 (9). Provides the jQuery > API via code hints and snippets in Dreamweaver's code view. > > Please send me

[jQuery] Re: File inputs

2008-01-30 Thread Hamish Campbell
Ah, I see. Maybe have a look at the uploader plugin? Otherwise, I think you're stuck :/ On Jan 30, 5:11 pm, "Steffan A. Cline" <[EMAIL PROTECTED]> wrote: > on 1/29/08 7:58 PM, Hamish Campbell at [EMAIL PROTECTED] wrote: > > > > > > > Some c

[jQuery] Re: change on select not working

2008-01-30 Thread Hamish Campbell
Whenever you create new selects you will need to bind the click event to the new selects. On Jan 31, 11:51 am, RyanMC <[EMAIL PROTECTED]> wrote: > $("select").change(function(){ >     alert("Selected: " + this.value); > > }); > > Is there any reason why this wouldn't be working on all the selects

[jQuery] Re: absolute beginner! How to set page width to window width?

2008-01-31 Thread Hamish Campbell
$(document).ready(function(){ $(window).resize(function(){ $('#pagewrap').width($(window).width()); }); }); The margin and padding of the body needs to be set to 0 for this to work properly. Note that as soon as you start adding borders to #pagewrap you're going to get problems. Also

[jQuery] Re: know if a css stylesheet is load

2008-01-31 Thread Hamish Campbell
You can check for the current css property value of an element - so, for example, you could set the background color of a hidden object and see check that value at run time. Are you loading css sheets dynamically? On Feb 1, 1:21 pm, Yahoo <[EMAIL PROTECTED]> wrote: > Theres any way with jquery t

[jQuery] Re: how to bind one action to multiple events?

2008-02-03 Thread Hamish Campbell
$('mySelector').mouseover(function() { // do something on mouseover and focus }) .focus(function(){ // trigger the mouseover event on focus $(this).trigger('mouseover') }); On Feb 4, 7:31 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > ... at least, that's what I think I need to

[jQuery] Re: Autogrow() "pulses" in IE7

2008-02-03 Thread Hamish Campbell
I'm seeing it too (on the demo page: http://www.aclevercookie.com/demos/autogrow_textarea.html) It happens while it has focus. On Feb 4, 9:35 am, Bruce MacKay <[EMAIL PROTECTED]> wrote: > Hello folks, > > Has anyone had experience with the autogrow plugin > (http://plugins.jquery.com/project/

[jQuery] Re: Moving DIVs up/down

2008-02-12 Thread Hamish Campbell
You can use 'insertBefore' to do this very easily. For example: $(document).ready(function(){ $('.smallDiv').click(function(){ $(this).insertBefore($(this).prev()); }); }); This will swap a 'smallDiv' element up by one when you click it. If it is already the first one, $(this)

[jQuery] Re: Translate old JS function to Jquery - Super newbie question

2008-02-12 Thread Hamish Campbell
A straight port would be: var confirmAction = function(action){ $('#button_'+action).hide(); $('#button_back').hide(); $('#confirm').trigger('submit'); // assuming the id of the form is 'confirm' return false; } On Feb 12, 11:18 am, Josoroma <[EMAIL PROTECTED]> wrote: > If i ha

[jQuery] Re: How to center div horizontally + vertically?

2008-02-18 Thread Hamish Campbell
Talked about this over here: http://groups.google.com/group/jquery-ui/browse_thread/thread/35a33d1c50f0e724/e527c8f47ba183e0?lnk=gst&q=extend+center#e527c8f47ba183e0 This is my extension to centre a div to the screen: $(document).ready(function() { jQuery.fn.centerScreen = function(load

[jQuery] Re: Using val() vs text()

2008-02-18 Thread Hamish Campbell
Could do it like this: $('#myElement:not(input)').text(s); $('#myElement:input').val(s); So you could have a function like: function setElement(id, s) { $('#'+id+':not(input)').text(s); $('#'+id+':input').val(s); }; So that whenever you set an element you can call: setElement('someEle

[jQuery] Re: I can't seem to break out of this frame.

2008-02-18 Thread Hamish Campbell
What if you name the top frame 'topFrame' and make the link into target='topFrame'? Or, better yet, ditch frames altogether :P :P :P On Feb 19, 1:16 pm, Justin <[EMAIL PROTECTED]> wrote: > Here's the page > > http://guestbook.spinskins.net > > It's just a guest book/comment section of my site. I

[jQuery] Re: .is() behaviour

2008-02-21 Thread Hamish Campbell
e you're clicking on the div as well. The nav div is still the target. >> It might even make sense to capture >> clicks that bubble up to the document object. Do you mean something like this: $('*').click($.delegate({ '#nav a.exit': function(){ /* do stuff */

[jQuery] Re: formatting/defining variable values

2008-02-21 Thread Hamish Campbell
What version of jQuery are you using? .val() should return "" rather than undefined if you find inputs successfully. HOWEVER, there is another problem: Putting ':checked' means that if the boxes are NOT checked, jQuery won't find them so .val() doesn't exist for the object. Remove the ':checked'

[jQuery] Re: Using jQuery without ready()

2008-03-03 Thread Hamish Campbell
http://docs.jquery.com/How_jQuery_Works#Launching_Code_on_Document_Ready On Mar 3, 10:21 am, fetis <[EMAIL PROTECTED]> wrote: > Hi, all. > I often use jQuery outside ready() function. Like this > > some html > >  $("#a").some actions > > > Have this way some hidden troubles or it's ok such usin

[jQuery] Re: BBC Site - jQuery

2008-03-03 Thread Hamish Campbell
jQuery for the win! On Mar 4, 12:50 am, Dan Mitchell <[EMAIL PROTECTED]> wrote: > Hi all, > > The new BBC website is using jQuery - a testament to how great jQuery > is! Go team jQuery! > > http://www.bbc.co.uk > > Regards > Dan

[jQuery] Re: Using jQuery without ready()

2008-03-03 Thread Hamish Campbell
loaded, you can put all your JS in one place and it's better coding style. I guess the question is: what are you trying to gain by NOT wrapping it in document.ready? On Mar 4, 11:02 am, fetis <[EMAIL PROTECTED]> wrote: > On Mar 3, 6:20 am, Hamish Campbell <[EMAIL PROTECTED]>

[jQuery] Re: Ajax Request Help

2008-03-04 Thread Hamish Campbell
So if your php page (called "submitVote.php") takes form vars (integer) "couponID" and (bit) "vote" and it returns the new percentage (eg "15%"), and the percentage value lives in a div called "votePercentage", and you have two buttons called 'voteYes' and 'voteNo': $('document').ready(function()

[jQuery] Re: how to get the size of the image file before user upload it.

2008-03-05 Thread Hamish Campbell
File size or dimensions? On Mar 4, 4:25 pm, Xinhao Zheng <[EMAIL PROTECTED]> wrote: > hi all, > >     is there a way to do this that can work both under ie and FF.thanks > in advance. > > George

[jQuery] Re: Vertically aligning a div

2008-03-05 Thread Hamish Campbell
My solution from: http://groups.google.com/group/jquery-ui/browse_thread/thread/35a33d1c50f0e724/e527c8f47ba183e0?lnk=gst&q=extend+center# and in action at www.deft.co.nz $(document).ready(function() { jQuery.fn.centerScreen = function(loaded) { var obj = this;

[jQuery] Re: callbacks calling callbacks calling callbacks ....

2008-03-07 Thread Hamish Campbell
Sounds like some sort of ajax queuing plugin is in order. Would have to be more complex than animation queues. eg, queue constists of a 1-d array. Each element in the array can be a request, or an array of requests (that execute simultaneously). The queue pops the first element, performs the call

[jQuery] Re: Targeting pseudo classes with jQuery

2008-03-07 Thread Hamish Campbell
Rather than setting CSS attributes directly, use classes. Eg, with hover: $('.someElements').click(function() { $('.someElements').removeClass('aSelected'); $(this).addClass('aSelected'); } $('.someElements').hover( function(){ $(this).addClass('aHover') }, function() {

[jQuery] Re: How to animate remove() and html() ?

2008-03-07 Thread Hamish Campbell
Remove: $('#someElement').hide('slow').remove(); Html: .html() isn't suitable - ie what does it mean to 'slowly' change the html content of an element?? Perhaps a typing effect, or cloning a div, changing the content then fading the original - but these would be specialised effects that you sho

[jQuery] Re: Tabs, AJAX, and wanting to degrade safely

2008-03-24 Thread Hamish Campbell
> However, taking this approach > would have multiple headers and > footers. How should I go about this? If you're using plain HTML then yes, you'll need to duplicate the header/footer data in the "fall back" pages. Do you have a database and/or server-side scripting language at your disposal?

[jQuery] Re: Tabs, AJAX, and wanting to degrade safely

2008-03-25 Thread Hamish Campbell
o put an HTML site on a CD.  So, no.  :-D > > On Mar 24, 3:57 pm, Hamish Campbell <[EMAIL PROTECTED]> wrote: > > > > > > However, taking this approach > > > would have multiple headers and > > > footers.  How should I go about this? > > > I

[jQuery] Re: Autocomplete and JSON

2008-04-01 Thread Hamish Campbell
>The JSON example on the autocomplete > site doesn't work as it sends the entire > remote data to the browser instead of > returning just a limited number of items. Probably becuase it requires a backend page to provide dynamic results based on the search query. Note: When the user starts t

[jQuery] Re: Ajax? issue in IE 7

2008-04-07 Thread Hamish Campbell
Either the event didn't bind properly, or something is preventing it reaching "return false;" Is the even definitely firing? Do your other calls include the fadeOut and, if not, does it work when you remove that line? On Apr 7, 9:39 am, David D <[EMAIL PROTECTED]> wrote: > I have a login box tha

[jQuery] Re: Automating forms / Command line web conversations

2008-04-07 Thread Hamish Campbell
GreaseMonkey? https://addons.mozilla.org/en-US/firefox/addon/748 On Apr 8, 10:15 am, Alan Gutierrez <[EMAIL PROTECTED]> wrote: > Recently, I wrote a bookmarklet that I used to step through a series   > of forms to delete a page on a wiki that I maintain. (Hundreds of   > spam pages had been adde

[jQuery] Re: find table column's (td's) header (th) ?

2008-04-08 Thread Hamish Campbell
Here is one way - it will find the header (th) for any cell (td) given that there are no merged cells and a single header row. $('td').click(function(){ var col = $(this).prevAll().length; var headerObj = $(this).parents('table').find('th').eq(col); // A quick test! alert("My cell he

[jQuery] Re: JQuery Selector

2008-04-09 Thread Hamish Campbell
This should be quite easy - for each section start you add some padding, for each section end you remove it: var sectionPadding = 0; var sectionIndent = 10; $('#survey div').each(function(){ if( $(this).is('.sectionend') ) { sectionPadding -= sectionIndent; } $(this).css('mar

[jQuery] Re: HTML Partial Element Does Not Exist?!

2008-04-09 Thread Hamish Campbell
Is this an ajax call? 90% of these questions seem to come down to the call not being completed. On Apr 10, 1:38 pm, OhNoMrBill <[EMAIL PROTECTED]> wrote: > Yup, agreed. Tried that method too. Both return undefined. Any other > thoughts on why the div and/or it's contents are not showing up in the

[jQuery] Re: Ajax? issue in IE 7

2008-04-10 Thread Hamish Campbell
what seems to be happening, but it only happens from > > the main page. I am running a php framework (xaraya) and any jquery > > code that is loaded from other templates appear to work correctly in > > IE 7. I'm rather stumped. The only thing I can think of is to work on > >

[jQuery] Re: Ajax - synchronous ajax call timeout

2008-04-10 Thread Hamish Campbell
Could you post your code? Looking at the source (1.2.3) it appears that timeouts are not set for syncronous calls. I'm not sure if it's even possible - the XMLHttpRequest doesn't appear to have a timeout method. The best solution would probably be to not use syncronous requests at all. You'd nor

[jQuery] Re: Ajax - synchronous ajax call timeout

2008-04-10 Thread Hamish Campbell
Err, this line: > Try the jQuery Development group - it sounds like a bug. Should read: Try the jQuery Development group, they might be able to explain why it does/doesn't work. I'm fairly sure that you can't script a timeout for syncronous though. On Apr 11, 11:35 a

[jQuery] Re: Popup window

2008-04-10 Thread Hamish Campbell
Have you considered using the jQuery UI Dialog plugin? http://docs.jquery.com/UI/Dialog On Apr 11, 11:50 am, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > Hey Paul, > > There isn't really any jQuery code that helps with this, but I've got a > little plugin "jqURL" that can make it a bit easier:

[jQuery] Re: Display ajax result in 2 divs

2008-04-10 Thread Hamish Campbell
Why don't you let jQuery handle the AJAX as well? The "." in your email probably contains some interesting code if you've created the call yourself: $.get('someurl.php', data, function(response) { $('.update_em').html(response).show(); }); http://docs.jquery.com/Ajax Ciao, Hamish On A

[jQuery] Re: "this" ?

2008-04-11 Thread Hamish Campbell
> $(".highlight").removeClass; The selector $('.highlight') is choosing all your objects that have the class 'highligh'. removeClass still needs to know what class to remove (ie, the method removeClass doesn't know how or why you selected those particular elements). It takes the class name as an

[jQuery] Re: HOWTO: Nested hover

2008-04-17 Thread Hamish Campbell
You could reapply the effect with mousemove. On Apr 17, 4:46 am, weepy <[EMAIL PROTECTED]> wrote: > Hi > > I have a div with other divs nested inside it (these may have further > divs nested inside). I want to provide a hover effect when each is > hovered upon. > > The trouble I have is that upon

[jQuery] Re: Issue inserting an img into a table

2008-04-21 Thread Hamish Campbell
Want to post your code? Whitespace could cause issues. Also, what if you set overflow:hidden for the tds? Thanks, Hamish On Apr 22, 8:04 am, Brian Ronk <[EMAIL PROTECTED]> wrote: > Well, the problem isn't actually putting the image into the table, > that part is fine.  I'm running into a prob

[jQuery] Re: query string encrypt/decrypt plugin????

2008-04-21 Thread Hamish Campbell
I don't think it would deter anyone any more than using POST - it's just as trivial to use firebug to call your encrypt/decrypt function as it is to modify an ajax call in transit. I could concievably help stop evesdroppers - but if you need to protect the data in transit it should be over a secur

[jQuery] Re: searching css id

2008-04-22 Thread Hamish Campbell
Because this wasn't immediately obvious to me when I started out, here is why: The jQuery selector will always return an object. Eg: typeof($("#doesntExist")) == "object". That means if( $("#doesntExist") ) will evaluate true. This is intentional - ie, if you do something like this: $

[jQuery] Re: Question: Selecting all the links in div

2008-04-23 Thread Hamish Campbell
Could you post the html? That would help a lot. If the links exist your code should work. btw, ripple, you shouldn't need to use 'each' - addClass will apply to all objects in the collection. Using 'each' just adds overhead. On Apr 24, 3:14 am, ripple <[EMAIL PROTECTED]> wrote: > Why not loop th

[jQuery] Re: Ajax strip javascript?

2008-04-28 Thread Hamish Campbell
How are you viewing the generated source? Bare in mind that just because you can't see javascript in the browser source of a page doesn't mean javascript hasn't been executed. Likewise, you wouldn't see the html loaded from an ajax call in the browser source -- as it was injected after the page w

[jQuery] Re: Get number of times a link has been "toggled" or clicked?

2008-04-28 Thread Hamish Campbell
I don't think it's worth a whole plugin to to this - it is relatively simple to add a counter to the toggle event functions, and to use the data object to store your counts. Eg: $('a.toggle').toggle( function() { $(this).data('count', 1 + ( $(this).data('count') || 0 ) ); $(this).css('co

[jQuery] Re: Ajax strip javascript?

2008-04-28 Thread Hamish Campbell
olkit, then viewing generated > source. > > > > Hamish Campbell wrote: > > How are you viewing the generated source? > > > Bare in mind that just because you can't see javascript in the browser > > source of a page doesn't mean javascript hasn't been

[jQuery] Re: Ajax strip javascript?

2008-04-28 Thread Hamish Campbell
load or .ajax?  I used .load and it does not work... > > On Apr 28, 3:49 pm, Hamish Campbell <[EMAIL PROTECTED]> wrote: > > > > > I've tried it myself - put an alert into the script and you should see > > something happen. jQuery executes script tags on load, bu

[jQuery] Re: IE6 problems?

2008-04-28 Thread Hamish Campbell
One alternative method is: $('#subnav li').eq(0).addClass('ieTop'); On Apr 29, 11:58 am, hubbs <[EMAIL PROTECTED]> wrote: > I am trying to add a class to the first child in IE6 because the css > first child does not work in IE6. > > So, here is what I used: > > $("#subnav li:first").addClass("ie

[jQuery] Re: Selector help

2008-04-28 Thread Hamish Campbell
Hi hi, ':has' and ':not' are your friends: $('#containerDiv tr:not(:has(div.taskSummary))') On Apr 29, 1:26 pm, Shawn <[EMAIL PROTECTED]> wrote: > Eventually got this working: > > $("tbody > tr", "#crewSchedule").each( function (pos) { >    if ($(".taskSummary", this).length == 0) { >      $(th

[jQuery] Re: - Is it possible to drive one fields results off another

2008-04-28 Thread Hamish Campbell
Yes, absolutely! ... I'll assume you were not looking for just a yes/no answer :p ... you should probably have a look at the online documentation, paying particular attention to the Ajax and Manipulation sections. Give it a stab first and if you have some more specific questions about the implem

[jQuery] Re: Only want to enable rollover behaivor for a certain class combination

2008-04-29 Thread Hamish Campbell
You'd use a selector like: $('.myClass:not(.selectedClass)') On Apr 30, 9:56 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > If an image has a class "myClass", I would like to set a mouseover/ > mouseout behavior.  However, if an image has two classes "myClass > selectedClass", I wo

[jQuery] Re: :contains( I WANT TO USE A VALUE HERE NOT A STRING ) well the value is a string

2008-04-30 Thread Hamish Campbell
First of all, in this: $('ul#list_container a:contains(hidden_div)') The word 'hidden_div' is just a string literal - ie it's just looking for the word hidden_div. If you want to look for the text you've assigned to the _variable_ hidden_div you just need to go: $('ul#list_container a:contains(

[jQuery] Re: :contains( I WANT TO USE A VALUE HERE NOT A STRING ) well the value is a string

2008-04-30 Thread Hamish Campbell
nd a plus around. Should be: > > $('ul#list_container a:contains(' + hidden_div + ')') > > Cheers, > --Karl > _ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Apr 30, 2008, at 3:38 PM, Hamish Campbell wrote: >

[jQuery] Re: New to jQuery.. Seeking help with early ideas

2008-05-04 Thread Hamish Campbell
First of all, hide the div so it's initially... err.. hidden. $('#subNav').hide(); Now you can throw in a function to call when the div loads content: $("a#interactive").click(function () { $("#subNav").load("work_interactive.html", {}, function() { $(this).show('slow'); // change t

[jQuery] Re: Right way to write a function

2008-05-09 Thread Hamish Campbell
Hi there, A quick fix is to modify your extension to: jQuery.fn.toggleActive = function(){ $('#iconBox ul.bar li').children("a").removeClass("active"); $(this).addClass("active"); }; You would then call by: $('#page2').click(function() { ($(this).children("a").toggleActi

[jQuery] Re: Is there a way of counting the number of id's with the same name, and then renaming them _1, _2, _3 etc.

2008-05-12 Thread Hamish Campbell
Even though you can't use the id selector directly, you can still use the id as an attribute selector (works in IE7 anyway). $(document).ready(function(){ $('div[id=wrapper]').each( function(i){ $(this).attr('id', $(this).attr('id')+'_'+(i+1)) } ); }); On May 13, 8:16

[jQuery] Re: JQuery and ASP.NET AJAX

2008-05-19 Thread Hamish Campbell
What do you mean exactly? I don't see why you couldn't, but I'm not sure why you would. Have an example? On May 19, 7:30 am, Mike <[EMAIL PROTECTED]> wrote: > Do these work well together or cause conflicts?

[jQuery] Re: JQuery and ASP.NET AJAX

2008-05-19 Thread Hamish Campbell
But ASP.NET provides controls that produce ajax type interactions right (I believe that was what Mike was referring to)? That is, it will be generating JS for the client. Obviously if you've got a clear understanding of what those ASP.NET controls do, you should be fine. Like I said though, if you

[jQuery] Re: JQuery Tablesorter can't sort number in Coldfusion

2008-05-19 Thread Hamish Campbell
jQuery works on the generated source seen by the browser - that is, it's CLIENT side. Rather than posting the CF SERVER source, could you post the source as seen by a browser viewing the page. That will be a LOT easier to decipher. For example, from the example above, we can't tell what the value

[jQuery] Re: Multiple Load Callback

2008-05-19 Thread Hamish Campbell
This has come up a few times - pretty sure there isn't a super clean way of doing it, but I'd probably prefer something like this: $("#div1").load( "scripts/generateA.php", {VAR: var}, checkLoaded ); $("#div2").load( "scripts/generateB.php", {VAR: var}, checkLoaded ); $("#div3").load( "scripts/ge

[jQuery] Re: Multiple Load Callback

2008-05-19 Thread Hamish Campbell
If you use the 'data' object, you can keep this stuff attached to the relevant objects and out of the global namespace. On May 20, 9:07 am, FreeKill <[EMAIL PROTECTED]> wrote: > That would chain them all together though right, rather than fire them > all off at the same time? > > I was thinking o

[jQuery] Re: Fade out the whole page before loading next page

2008-05-19 Thread Hamish Campbell
You have to intercept clicks on links, store the href while the page fades then redirect to that address: $(document).ready(function(){ $('a').click(function() { var target = $(this).attr('href'); $('body').fadeOut('slow', function() { window.location = target;

[jQuery] Re: JQuery Tablesorter can't sort number in Coldfusion

2008-05-19 Thread Hamish Campbell
H... CF might be causing the problem, but you'll still be able to see it in the generated code. Can you compare the output with and without - the difference should give you a clue as to why it isn't working. On May 19, 11:59 pm, Bettina <[EMAIL PROTECTED]> wrote: > Hi > > Yeah of course. Her

[jQuery] Re: .get(0) fails in 1.2.5

2008-05-21 Thread Hamish Campbell
Can't replicate here - are you SURE the id exists? On May 22, 9:56 am, "Brandon Aaron" <[EMAIL PROTECTED]> wrote: > This is working for me. Must be a little more deeply rooted. Could you try > and narrow things down? Create a simplified test-case that we could all > explore? > > -- > Brandon Aaro

[jQuery] Re: if all classes are hidden?

2008-05-21 Thread Hamish Campbell
if ( $('.box:visible').length == 0 ) { $('#left').hide(); On May 22, 12:13 pm, thekman <[EMAIL PROTECTED]> wrote: > Hi all, > I have a bunch of divs on my page that all have a class of box, the > boxes can be hidden by the div id, so when all are hidden, i also want > to hide their pare

[jQuery] Re: Do something, ONLY if parent has children

2008-05-28 Thread Hamish Campbell
You can do it with selectors: $('#main:not(:has(*))').hide(); Ie - 'select the element with the id "main" that does _not_ contain any other element'. Note that this is different from $('#main:empty') which includes text nodes. On May 29, 12:10 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote: > I

[jQuery] Re: Do something, ONLY if parent has children

2008-05-28 Thread Hamish Campbell
e a list of specific elements, and if an > element with a specific class does not come after the first element, > hide the first element. > > Sorry this sounds strange.  I am trying to create a work around for my > CMS. > > On May 28, 5:53 pm, Hamish Campbell <[EMAIL PRO

[jQuery] Re: get class or id

2008-06-02 Thread Hamish Campbell
Two elements should never have the same ID - make sure the links and the paragraphs do NOT have the same ID. Some people use the 'rel' tag for this sort of thing. Use the class attribute to denote objects that should be grouped (ie, the paragraphs you want to hide) Eg: 001 002 003

[jQuery] Re: Calculate time since post

2008-06-03 Thread Hamish Campbell
This is better done on the server side with a scripting language, or with basic javascript - the following page should help: http://www.w3schools.com/jsref/jsref_obj_date.asp On Jun 3, 6:04 pm, hubbs <[EMAIL PROTECTED]> wrote: > I am wondering if jQuery has any solutions to calculate the time si

[jQuery] Re: Scroll event doesn't work in IE

2008-06-03 Thread Hamish Campbell
Hihi, scroll is a window event. Try: $(window).scroll(function(){ alert('W00t!'); }); On Jun 4, 2:41 am, taxpehbam <[EMAIL PROTECTED]> wrote: > For some reason code below doesn't work in IE. I don't think i found a > bug, maybe i'm doing something wrong? > > $(document).scroll(function(){ >

[jQuery] Re: Selector: Find the first letter?

2008-06-10 Thread Hamish Campbell
Nothing wrong with regex. Note that the expression you have will catch all Caps and Numbers - so something like "Go Here" will have the G and H in the spans. A better pattern might be /^([A-Za-z0-9])/g -- this will match the first character of the link, but only if it is a sensible character (ie,

  1   2   >