M
M
Mikhail Petrov2016-07-19 11:02:52
JavaScript
Mikhail Petrov, 2016-07-19 11:02:52

How to click on a class?

I can not click, I do this, but it does not work. What am I doing wrong? How to click on a class that has a space in its name? Or is it due to the fact that on the site where I'm trying to https? Thank you.

<a class="nowrap tooltip-delayed" title="Обзор" href="/game.php">Перейти</a>

$(document).ready(function(){ 
    $('.nowrap tooltip-delayed').click(); 
    //alert ('jQuery подключен');   
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2016-07-19
@fatklass

Class names cannot contain spaces. In this case, the link has two classes - nowrap and tooltip-delayed . Accordingly, in order to select links that have both of these classes, the selector must be corrected to
$('.nowrap.tooltip-delayed').click();

K
ksnk, 2016-07-19
@ksnk

And you need to click with the trigger function
$('.nowrap.tooltip-delayed').trigger("click");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question