Try this, wasn't sure if you were missing any tags so I've put the whole thing in.
You forgot to quote the href string literal: var link = $(this). Attr("href"); ^ ^ Also, you will need to cancel the default behavior of the click event. Currently, your event handler would fire, but you would not see the result, as the browser continues to follow the link you have clicked.
Add a return false; as the last line of the event handling function to cancel this behavior.
Fixed that, but its because I written this simple example fast for this question. But main problem is not in this :) – faya May 18 '10 at 8:34 @faya: See my update (or any of the other answers which seems to point out the lack of return false as well). – Jørn Schou-Rode May 18 '10 at 8:41 The problem is in setting the event handler on anchors inside container :) – faya May 18 '10 at 8:47 @faya: With the two corrections in place, it works fine on my machine.
The problem lies somewhere else in your code. Start picking it apart, line by line, to find the culprit. – Jørn Schou-Rode May 18 '10 at 8:59.
Add return false;. $("#my-container a"). Click(function() { var link = $(this).
Attr("href"); $("#my-container"). Load(link); return false; }).
You can do like: $(function(){ $("#my-container > a"). Click(function() { var link = $(this). Attr('href'); $('#my-container').
Load(link); return false; }); }); But if you meant that you don't want to give the div any id or class then any div having links inside it will also be affected. So you should at least give the id to the div you want to load the content in.
I meant no id or class attributes for the anchors. It is because my pagination framework doesn't let me add automatically id or class attributes to generated anchors. And as you can see div has id attritbute.
– faya May 18 '10 at 8:40 @faya: The code seems to be fine, what error do you get? – Sarfraz May 18 '10 at 8:42 I don't get any error. I set for the test $("#my-container > a").
Click(function() { alert('test')});. I click link and alert doesn't get invoked. As far as I know it means click event isn't set.
I also tried with $. Live, but seems its the same... – faya May 18 '10 at 8:46 @faya: Make sure that you have include the jquery file and path is correct. – Sarfraz May 18 '10 at 8:50.
Have you try it with the bind function: $("#my-container a"). Bind("click", function() { var link = $(this). Attr("href"); $("#my-container").
Load(link); }).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.