user561815
user561815

Reputation: 53

opening link in same window using jquery

.bind('click',function(){ window.open($(this).find('.pc_more').html()); }); });

is there something in this part of the code that tells it to open the link in a new page? can i put some code to open the link in the same window?

Upvotes: 5

Views: 17328

Answers (2)

T.J. Crowder
T.J. Crowder

Reputation: 1074008

You're looking for:

.bind('click', function(){
    window.location = $(this).find('.pc_more').html();
});

...assuming that the element matched by .pc_more really has a link as its HTML.

Live example

Upvotes: 8

Ivan Hušnjak
Ivan Hušnjak

Reputation: 3503

Try using window.location instead of window.open().

window.location = $(this).find('.pc_more').html();

Upvotes: 3

Related Questions