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

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

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

[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 script     $(document).ready(function(){         .. another

[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

[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 developer would find

[jQuery] Re: JQuery variables

2008-06-19 Thread Hamish Campbell
Hi there. Best (or fastest) way to find out if something is in the DOM is to check: if ( $(#createNewAccount).length ) If .length is greater than 0 it will exist. So your script can read: $(document).ready(function() { if ( $('#createNewAccount:checked').length || !$

[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 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: 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 it could

[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: script language=javascript type=text/javascript $(document).ready(function(){ $.fn.extend({

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

[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

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

[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: 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: ul id=myList lia

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

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

2008-05-28 Thread Hamish Campbell
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 PROTECTED] wrote: You can do it with selectors: $('#main:not(:has(*))').hide(); Ie - 'select the element

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

[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

[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

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

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

[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 cfoutput - 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.

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

[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).toggleActive();

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

[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

[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
(' + hidden_div + ')') Cheers, --Karl _ Karl Swedbergwww.englishrules.comwww.learningjquery.com On Apr 30, 2008, at 3:38 PM, Hamish Campbell wrote: First of all, in this: $('ul#list_container a:contains(hidden_div)') The word 'hidden_div' is just a string literal

[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 would like to

[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

[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 ) );

[jQuery] Re: Ajax strip javascript?

2008-04-28 Thread Hamish Campbell
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 executed. Likewise, you wouldn't see the html loaded from an ajax call

[jQuery] Re: Ajax strip javascript?

2008-04-28 Thread Hamish Campbell
. Hamish On Apr 29, 12:04 pm, hubbs [EMAIL PROTECTED] wrote: Did you use .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

[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) {      $(this).toggle();

[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

[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

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

[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

[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
$(.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: Ajax? issue in IE 7

2008-04-10 Thread Hamish Campbell
in IE 7. I'm rather stumped. The only thing I can think of is to work on the rest of the project and hope I find an answer somewhere along the way. David D On Apr 6, 10:35 pm, Hamish Campbell [EMAIL PROTECTED] wrote: Either the event didn't bind properly, or something is preventing

[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

[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 am, Hamish Campbell [EMAIL

[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

[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; }

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

[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

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

2008-03-25 Thread Hamish Campbell
, 3:57 pm, Hamish Campbell [EMAIL PROTECTED] wrote: 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

[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? On

[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

[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

[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=gstq=extend+center# and in action at www.deft.co.nz $(document).ready(function() { jQuery.fn.centerScreen = function(loaded) { var obj = this;

[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
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 div id=asome html/div script  $(#a).some actions /script Have this way some hidden troubles or it's

[jQuery] Re: Using jQuery without ready()

2008-03-03 Thread Hamish Campbell
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] wrote: http://docs.jquery.com

[jQuery] Re: .is() behaviour

2008-02-21 Thread Hamish Campbell
that bubble up to the document object. Do you mean something like this: $('*').click($.delegate({ '#nav a.exit': function(){ /* do stuff */ }, '#nav a.open': function(){ /* do other stuff */ } }); ... that looks like a _really_ bad idea. Thanks Hamish Campbell On Feb 21, 9:42 am

[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: 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=gstq=extend+center#e527c8f47ba183e0 This is my extension to centre a div to the screen: $(document).ready(function() { jQuery.fn.centerScreen =

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

[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. If you

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

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

[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 do!

[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

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

[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 code would be useful - you've said that .click() doesn't work

[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 on my

[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

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

[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 wrote: I know

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

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

2008-01-22 Thread Hamish Campbell
); ... } On Jan 22, 12:03 am, Hamish Campbell [EMAIL PROTECTED] wrote: 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

[jQuery] Re: A Beginner Question

2008-01-22 Thread Hamish Campbell
Here's how you do it (tested and working): !-- HTML -- dl dta href=No-Javascript-URL_AItem Group A/a/dt ddItem 1/dd ddItem 2/dd dta href=No-Javascript-URL_BItem Group B/a/dt ddItem 1/dd ddItem 2/dd ddItem 3/dd /dl script $(document).ready(function() {

[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

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

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

[jQuery] Re: jmaps - callback function problem

2008-01-17 Thread Hamish Campbell
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, 2008 7:23 PM, Hamish Campbell [EMAIL PROTECTED] wrote: It's a great plugin - I'm using it (well, jmap2 actually) at isat.deft.co.nz

[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 setInterval is

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

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

[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 || ...test

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

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

2008-01-15 Thread Hamish Campbell
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: The function 'force' belongs to the document.ready call

[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

[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: hr title=some text! / In the JS: $(document).ready(function(){

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

  1   2   >