[jQuery] Why does this work??
Hi, I have a question that puzzles me a lot. I have the following code: $(document).ready(function() { $(#somediv).load(/some/content); }) The code inserted with AJAX contains two things. 1. A script tag that states things like: $(#Cancel).click(function(e) { e.preventDefault(); alert(you cancled); }) 2. A div with various elements, like the button with ID Cancel. When I click that Cancel button, the alert executes just like I want it to do. But I can't figure out why?? I mean how can the eventhandler register correctly. Is the Cancel button from the AJAX call somehow magically insert into the DOM before the script registering the event executes? -- View this message in context: http://old.nabble.com/Why-does-this-work---tp26934213s27240p26934213.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Why does 'attr' work with 'divs' and not 'p's'?
Using the following code jquery var originalTitle=$(a.basic).attr(title); $(div.area1).text(originalTitle); html pThis is where the original title should go/p div class=area1/div I get the expected title attribute written into the 'div'. However, if I swap the 'div' for a 'p' the result is that the 'href' is written into the paragraph instead of the title. Here is the modified code that produces the unexpected result: jquery var originalTitle=$(a.basic).attr(title); $(p.area1).text(originalTitle); html pThis is where the original title should go/p div class=area1/div I suspect the problem is cockpit error but I wondered if there is some restriction on this combination of jquery that requires a 'div' for the area where the text is written. Alternatively is someone can point out my error that would be much appreciated. Thanks.
Re: [jQuery] Why does 'attr' work with 'divs' and not 'p's'?
jquery var originalTitle=$(a.basic).attr(title); $(p.area1).text(originalTitle); html pThis is where the original title should go/p div class=area1/div Your selector is looking for a paragraph with a class of 'area1'. However, there is no paragraph with that class in your markup. -DA
[jQuery] Why does this work in FF - but IE fails?
What am I missing here? I'm trying to adjust the wrapper-div's width to match the actual image width... http://navigate.de/dev/caption.html any advice appreciated!
[jQuery] why does this work in 1.2.6 but not 1.3.2?
I haven't tried the following in 1.3.0/1 - I went to upgrade something to 1.3.2 and noticed the form didn't work any more. I have a radio button that I want to reprocess a the form when it is changed. I read somewhere that some browser (probably IE) didn't record the onchange of radios but that click essentially did the same thing. So that's what I did: $(input[name='number_tickets']).click(adjust_payment); This works in 1.2.6 but in 1.3.2 it doesn't. But if I change it to $(input[name='number_tickets']).live('click',adjust_payment); it does work in 1.3.2 I'm using FF3 with firebug
[jQuery] why does this work in 1.2.6 but not 1.3.2?
I haven't tried the following in 1.3.0/1 - I went to upgrade something to 1.3.2 and noticed the form didn't work any more. I have a radio button that I want to reprocess a the form when it is changed. I read somewhere that some browser (probably IE) didn't record the onchange of radios but that click essentially did the same thing. So that's what I did: $(input[name='number_tickets']).click(adjust_payment); This works in 1.2.6 but in 1.3.2 it doesn't. But if I change it to $(input[name='number_tickets']).live('click',adjust_payment); it does work in 1.3.2 I'm using FF3 with firebug