Opening a link in the same window using jquery

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

Is there anything in this part of the code that tells him to open the link on a new page? can i put some code to open the link in the same window?

+4
source share
2 answers

You are looking for:

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

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

Living example

+7
source

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

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

Source: https://habr.com/ru/post/1334126/


All Articles