var link = "http:/javascript.ru"; $('.block').before('<div class="url" onclick="window.open('+link+');return false;">');