[jQuery] Re: jquery and json triggers no event.

2009-11-10 Thread Mr Speaker
The a.delete click handler only attaches to _current_ elements on the page. If you want to bind to future elements (that you build dynamically) you can use the .live method: $(a.delete).live( click, function(){ alert( test ); } ); (Also, another solution is to take advantage of event delegation

[jQuery] Re: Selection logic

2009-11-10 Thread Mr Speaker
BTW, just to be clear: there shouldn't EVER be a reason ever to do: $($ (el).parents('div').get(0)).addClass('blah') You'd just be getting all the parent divs, asking for their actual DOM references (for no reason) then re-wrapping them into jQuery objects before adding classes to them! On Nov

[jQuery] Re: event.currentTarget with table rows and IE7

2009-09-18 Thread Mr Speaker
The event you get from jQuery handlers is normalised. CurrentTarget is just this in the function. mouseover(event){ alert(this.id); } On Sep 19, 7:00 am, Philipp philipp.ma...@googlemail.com wrote: Hi, I got a problem using the following code: $j = jQuery.noConflict();

[jQuery] Re: event.currentTarget with table rows and IE7

2009-09-18 Thread Mr Speaker
Woah, I just noticed (2 minutes after my reply) this post: http://brandonaaron.net/blog/2009/05/12/jquery-edge-bind-with-a-different-this That says in 1.3.3 that currentTarget will be normalised cross-browser too. On Sep 19, 7:00 am, Philipp philipp.ma...@googlemail.com wrote: Hi, I got a

[jQuery] Re: Simple/short way to bind one event to multiple objects?

2009-09-15 Thread Mr Speaker
you can select multiple objects in the selector, like: $ (#obj1,#obj2,#obj3).change(...) On Sep 15, 7:42 am, cgp cgpala...@gmail.com wrote: I have 2 or more objects that onclick(), will call the same function. Right now I have the following: $(#obj1).change( function() {        

[jQuery] Re: Problem with .live() events in a widget in FF3

2009-09-15 Thread Mr Speaker
Is it just because alert() is not allowed in FF? (needs to be alert(1) or some-such). The code looks fine to me otherwise. On Sep 15, 5:38 am, ChrisP idevt...@gmail.com wrote: I am creating a simple jQuery widget and have the following two lines in the _init() method.    

[jQuery] Re: Get the onclick method of an element

2009-09-15 Thread Mr Speaker
I think you need to set the context for the function to that of the link using the JavaScript call function... like: function DoSomething( ctx ){ alert( ctx.text ); } var linky = $('a'); var onclick = $('a').attr('onclick'); onclick.call(linky[0]); // Alerts 'asd' BTW: the linky[0]

[jQuery] Re: A simple .each() function question

2009-09-15 Thread Mr Speaker
Yep, jquery functions apply themselves to all the elements you selected. You only need to use each command if you need to do your own custom handling... Lik um, $(li).each(function(idx){ $(this).css('background-color', '#' + idx + idx + idx); }); Ok, bad example (this sets the background

[jQuery] Re: Help with error script

2009-09-15 Thread Mr Speaker
I think the problem is that you only ever remove a node when there is no errors. Why don't you just remove ALL error messages each call - so you'll only ever be showing the most recent error: function(error){ $('.error-message').remove(); //remove ALL previous error messages

[jQuery] Re: event coordination problem

2009-09-14 Thread Mr Speaker
[mailto:jquery...@googlegroups.com] On Behalf Of Mr Speaker Sent: Sunday, September 13, 2009 10:07 PM To: jQuery (English) Subject: [jQuery] Re: event coordination problem I pasted your code into a new HTML doc and it ran as expected: if you put the focus in the textbox (#id1) then click

[jQuery] Re: event coordination problem

2009-09-13 Thread Mr Speaker
I pasted your code into a new HTML doc and it ran as expected: if you put the focus in the textbox (#id1) then click the button (#id2) both events get fired (blur event fires first, click event fires second). Is there anything else in your page? Are you getting any JS errors? On Sep 13, 4:27 

[jQuery] Re: is this possible with jquery

2009-09-11 Thread Mr Speaker
That website you linked to doesn't use Ajax, so it loads all the wines in in one go. If there wasn't many items then this would be the best way to go. Otherwise, you'll have to take the db hit: which wouldn't be too bad if you've got it caching stuff properly... But if you load them all at once

[jQuery] Re: Hover Not Working As Expected

2009-09-11 Thread Mr Speaker
Your code is fine - I think it has to do with the float cascading to the menu items. If you add in float:none to the children li elements it should work: #NavList li ul li { ... float:none; } On Sep 11, 10:27 pm, GLSmyth george.sm...@gmail.com wrote: I am missing something fundamental and am

[jQuery] Re: Tabs - Fade and Rotate

2009-09-09 Thread Mr Speaker
Any extra options for the toggle can go where the opacity option is: { fx: { opacity: 'toggle', duration: 1000 } } On Sep 10, 7:27 am, -e-train etrai...@gmail.com wrote: All - I have a set of tabs that I have gotten to rotate through via this scipt: $(document).ready(function(){          

[jQuery] Re: My simple fading div test isn't working, firebug says anchor tag is null?

2009-09-09 Thread Mr Speaker
That code looks fine - so wordpress must be messing it up. It looks like jQuery is loading fine, else it would never get to the $ ('a') line. Perhaps you could try the LIVE event: $(function() { $('a').live( click, (function() { $('#box').fadeOut(); }); }); Which would add the click

[jQuery] Re: HTML code inside script tag, how access to it with DOM???

2009-09-09 Thread Mr Speaker
I think it's perfectly valid to have a div inside a script tag (or at least useful), if a div makes sense to the TYPE you defined for the script. For example, John Resig uses a script tag with type text/ html in his micro-templating solution: http://ejohn.org/blog/javascript-micro-templating/ In

[jQuery] Re: jQuery UI Resizable Plugin – Scaling a div AND the contents within?

2009-09-09 Thread Mr Speaker
I thought that's what alsoResize was for... couldn't you do something like: $('#myDiv').resizable({alsoResize: '#myDiv img'}); or something like that? Otherwise, perhaps you could use the resizable event, and do the resizing yourself: $('#myDiv').resizable({ resize: function(event, ui) {

[jQuery] Re: Superfish - adding a start menu button

2009-09-09 Thread Mr Speaker
Just use put a mouseover event on the trigger which shows the menu, and a mouseout event on the menu itself... like a href=# id=startButtonStart/a ul id=startMenu liAll Programs/li liRecent Documents/li liUpgrade to a Mac/li /ul $('#startButton').mouseover(function(){

[jQuery] Re: Help with Add/Removing Classes

2009-09-09 Thread Mr Speaker
What's the problem? That code looks perfect... have you looked in Firebug to see where it's adding/removing the class names? On (unrelated) issue the code might have is the selector you use is '#nav li a' which will select all of those second level nav elements too: red/green/black - if that's

[jQuery] Re: Problems with blur/focus when validating a field

2009-09-09 Thread Mr Speaker
I think the problem is that according to the W3C standards, the blur event is not cancelable: They don't seem to want the programmer to be able to mess with a blur... But also, your validation code is a bit buggy anyway: the ret variable is undefined and the regex you use will only catch the

[jQuery] Re: Problems with blur/focus when validating a field

2009-09-09 Thread Mr Speaker
can be prevented by returning false. Maybe it should be corrected. Your suggestion of using setTimeout produces the desired results. Like you said, not too pretty but effective. Thanks! On Sep 9, 7:40 pm, Mr Speaker mrspea...@gmail.com wrote: I think the problem is that according

[jQuery] Re: HTML code inside script tag, how access to it with DOM???

2009-09-09 Thread Mr Speaker
- I'm guessing they got stuck implementing some dodgy Facebook app... ergh. So, best of luck to him/her! On Sep 10, 1:59 pm, RobG robg...@gmail.com wrote: On Sep 10, 9:49 am, Mr Speaker mrspea...@gmail.com wrote: I think it's perfectly valid to have a div inside a script tag

[jQuery] Re: Problems with blur/focus when validating a field

2009-09-09 Thread Mr Speaker
I think they don't let you hold focus for a reason... I've tried it on a couple of my forms and it's annoying! I wanna leave it blank and come back to it damn it! ;) On Sep 10, 2:27 pm, Mr Speaker mrspea...@gmail.com wrote: It's like tabbing to the next field is NOT the default action