[jQuery] Announcing Concrete - a jQuery library for structured code development

2009-10-14 Thread hamish
s it designed for, it can out-perform jQuery's native Sizzle selector engine by an order of magnitude. Developed by me, Hamish Friedlander, and partially sponsored by SilverStripe (http://www.silverstripe.org/), Concrete is in use in several projects internally, and is a key component of the

[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: Using jQuery on imported content

2008-07-14 Thread Hamish Campbell
Are you attaching the click handlers before or after you load the ajax content? If you're trying to apply the click handler before, it won't work because the anchors don't exist yet. Either apply the click handler after the content is loaded, or use a plugin like LiveQuery to handle updates for

[jQuery] Re: JS not working

2008-07-12 Thread Hamish Campbell
Not familiar with corners, but the problem is that you're applying corners before the div called "differentcorners" exists. The line $("#differentcorners").corner("tl 8px").corner("tr br 8px"); is being executing once the page is loaded - it searches for the div called 'differentcorners', but at

[jQuery] Re: jQuery events don't work after AJAX load

2008-07-07 Thread Hamish Campbell
Possibly one of the most frequently asked questions: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F On Jul 8, 1:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi folks, > > I have a page with a photo on it.  I load the comments f

[jQuery] Re: is this bug ? bind not work

2008-06-29 Thread Hamish Campbell
Does the image exist in the DOM on page load complete? On Jun 30, 1:44 pm, Adwin Wijaya <[EMAIL PROTECTED]> wrote: > Hi ... > > I have table and inside contains image which class name = 'reason_img' > > my js script was like this > >     $(document).ready(function(){ >         .. another in

[jQuery] Re: Debugging $.getScript scripts

2008-06-21 Thread Hamish Campbell
Nevermind - reread your post and Charles won't help debugging the remote script execture - just in checking that your response is what you expect. On Jun 21, 8:12 pm, Hamish Campbell <[EMAIL PROTECTED]> wrote: > Charles is a proxy debugging tool that (i think) every Ajax develope

[jQuery] Re: Debugging $.getScript scripts

2008-06-21 Thread Hamish Campbell
Charles is a proxy debugging tool that (i think) every Ajax developer would find useful debugging this sort of thing: http://getcharles.com Lets you look under the hood without modifying your code. On Jun 21, 8:59 am, ajpiano <[EMAIL PROTECTED]> wrote: > So literally no one has ever wanted to d

[jQuery] Re: JQuery variables

2008-06-19 Thread Hamish Campbell
eNewAccount' ) { show the div } otherwise { hide it } Hope this helps! Hamish On Jun 20, 2:10 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi all. I've done some searching, but being new to this am struggling > to find what I'm after even though I'

[jQuery] Re: Loading google maps dynamically

2008-06-18 Thread Hamish Campbell
It looks like you're getting the script ok, but there is other stuff you need to do to create a google map. There are a couple of good jQuery googlemap plugins (eg, jMaps) So you'd do something like this: $("#togglegmaps").toggle( function(){ $.getScript("http://maps.google.com/maps?

[jQuery] Re: scope of jquery functions?

2008-06-17 Thread Hamish Campbell
The issue is that the click function is bound on document.ready - so stuff added later won't have the binding. See the FAQ: http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F On Jun 18, 10:21 am, Brian Cummiskey <[EMAIL PROTECTED]> wrote: >

[jQuery] Re: how to make browser ensure specific element is visible

2008-06-16 Thread Hamish Campbell
Hi Colin, The dimensions plugin was recently added to the jQuery core, and you can combine with the plain javascript window.scrollTo method to do what you want. Here is a little plugin I whipped up: $(document).ready(function(){ $.fn.extend({ showAndScroll: function() { $(thi

[jQuery] Re: Is there a way to use the css function with $(document) directly?

2008-06-16 Thread Hamish Campbell
As an example do you mean: $(document).css('p', 'color: red').css('h1', 'font-size: 200%'); On Jun 14, 6:13 am, "Brian J. Fink" <[EMAIL PROTECTED]> wrote: > I was tinkering with jQuery when I got an idea: why not have a way to > do something like: > > $(document).css(selector,rule); > > Then i

[jQuery] Re: How to tell submit event to wait for method to return

2008-06-16 Thread Hamish Campbell
Change "return true" to "return false". I assume the geoencode() function fires some sort of ajax call. You'll need to submit the form once this ajax call has returned a result. Note that currently, when your function hits "return true", it has fired off the request but a response has yet to be

[jQuery] Re: AJAX data inserted into DOM does not trigger click-event

2008-06-15 Thread Hamish Campbell
http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F On Jun 16, 4:52 am, Thasmo <[EMAIL PROTECTED]> wrote: > Hoi guys! > > I define a event trigger $('#id div a).click(). > > The url in the href attribute of the a tag is called via $.ajax > and

[jQuery] Re: ajax delay to triggering callback

2008-06-11 Thread Hamish Campbell
That's not a bad idea. Maybe more suitable for a plugin than in the core though. I guess there are a couple of issues: First of all, it might be tricky setting up a timed callback to an annonymous function. You'd probably have to restrict it to named callbacks. Secondly, to do it right you'd pr

[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,

[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: 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: 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: 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: 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: 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: .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: 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: 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: 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: 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: 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: 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 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: 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: 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: 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: :contains( I WANT TO USE A VALUE HERE NOT A STRING ) well the value is a string

2008-04-30 Thread Hamish Campbell
What? jQuery can't handle gross js syntax errors? Piffle & rot! :-p On May 1, 1:21 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > > $('ul#list_container a:contains(' + hidden_div' + )') > > Hey Hamish, > > Looks like you switched a quote a

[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: 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: - 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: 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: 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: Ajax strip javascript?

2008-04-28 Thread Hamish Campbell
your browser. If you get the alert, scripts are loading and the problem is in whatever javascript is in the loaded page. If you don't get the alert, you might need to manually set the datatype to html. Hamish On Apr 29, 12:04 pm, hubbs <[EMAIL PROTECTED]> wrote: > Did you use .

[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: 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
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: 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: searching css id

2008-04-22 Thread Hamish Campbell
- ie, if you do something like this: $("#doesntExist").hide() you won't get nasty js errors. Cheers, Hamish On Apr 23, 7:29 am, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > Try doing > > if ( $('#specialSection').length ) > > in your conditi

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

2008-04-21 Thread Hamish Campbell
d attempts - sometimes increasing the delay for subsequent attempts. Might be a little specialised for a jQuery plugin, but who knows? Cheers, Hamish On Apr 22, 5:03 am, joomlafreak <[EMAIL PROTECTED]> wrote: > Hi > > I have been looking for code that can let me encrypt the query str

[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

[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: "this" ?

2008-04-11 Thread Hamish Campbell
$('h1').each(function(){ $(this).css('color': 'red'); }); $(this) refers to the particular 'h1' element that is being iterated over. Using ':even' narrows a selection of objects to only even ones. You don't use it with 'this'

[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:/

[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: 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: 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? 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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
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: formatting/defining variable values

2008-02-21 Thread Hamish Campbell
e object. Remove the ':checked' and try again. Cheers, Hamish On Feb 21, 11:32 am, Robert Hill <[EMAIL PROTECTED]> wrote: > Hello > > I'm collecting a number of values from various form elements: > textfield, radio, checkbox. > > since some of the fields ar

[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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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-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: 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: 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: 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: 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: 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: 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: 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: 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: 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: jmaps - callback function problem

2008-01-17 Thread Hamish Campbell
+point.y); alert('lng: '+point.x); } }); } // test it out: customGeoCode('Auckland, New Zealand'); Bypasses those functions and you don't even need a map. On Jan 17, 11:25 pm, Duncan <[EMAIL PROTECTED]> wrote: > Th

[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: jmaps - callback function problem

2008-01-16 Thread Hamish Campbell
address: $('#fromAddress').val(), cache: $.jmap.GGeoCache, returntype: 'object' } lat = address[1]; lng = address[0]; I haven't tested this, but from the source code of the plugin, the returntype option is there e

[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

  1   2   >