Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opening link in same window using jquery

Tags:

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?

like image 251
user561815 Avatar asked Jan 03 '11 21:01

user561815


2 Answers

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

like image 128
T.J. Crowder Avatar answered Oct 05 '22 02:10

T.J. Crowder


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

window.location = $(this).find('.pc_more').html();
like image 27
Ivan Hušnjak Avatar answered Oct 05 '22 03:10

Ivan Hušnjak