3
votes

J'ai un problème concernant jquery contient une erreur de syntaxe

J'essaie d'utiliser le sélecteur jquery: contains () avec lequel je trouve ma question et je supprime la classe de celle-ci, mais en ce sens, j'ai un problème d'erreur de syntaxe de visage, j'ai montré mon code ci-dessous.

p >

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<div class="wrap">
    <ul>
        <li class="current-question">
            <i class="fa fa-bookmark" aria-hidden="true"></i>
            <span class="question-dot"></span>
            <a class="view_all_que">
                <p>A penetration tester is conducting a port scan on a specific host. The tester found several ports opened that were confusing in concluding the Operating System (OS) version installed. Considering the NMAP result below, which of the follow is likely to be installed on the target machine by the OS? Starting NMAP 5.21 at 2011-03-15 11:06 NMAP scan report for 172.16.40.65 Host is up (1.00s latency). Not shown: 993 closed ports PORT STATE SERVICE 21/tcp open ftp 23/tcp open telnet 80 /tcp open http 139/tcp open netbios-ssn 515/tcp open 631/tec open ipp 9100/tcp open MAC Address: 00:00:48:0D:EE:8</p>
            </a>
        </li>
                                        
    </ul>
</div>
var question = 'A penetration tester is conducting a port scan on a specific host. The tester found several ports opened that were confusing in concluding the Operating System (OS) version installed. Considering the NMAP result below, which of the follow is likely to be installed on the target machine by the OS? Starting NMAP 5.21 at 2011-03-15 11:06 NMAP scan report for 172.16.40.65 Host is up (1.00s latency). Not shown: 993 closed ports PORT STATE SERVICE 21/tcp open ftp 23/tcp open telnet 80 /tcp open http 139/tcp open netbios-ssn 515/tcp open 631/tec open ipp 9100/tcp open MAC Address: 00:00:48:0D:EE:8';

$('.wrap .view_all_que:contains('+question+')').parent('li').removeClass('current-question');

et ça me montre:

Erreur non interceptée: erreur de syntaxe, expression non reconnue: .wrap .view_all_que: contient (Un testeur de pénétration effectue une analyse de port sur un hôte spécifique. Le testeur a trouvé plusieurs ports ouverts confusion pour conclure que la version du système d'exploitation (OS) est installée. Compte tenu du résultat NMAP ci-dessous, lequel des éléments suivants est susceptible d'être installé sur la machine cible par le système d'exploitation? Démarrage de NMAP 5.21 à 2011-03-15 11:06 Rapport d'analyse NMAP pour 172.16.40.65 L'hôte est actif (1.00s latence). Non illustré: 993 ports fermés PORT STATE SERVICE 21 / tcp open ftp 23 / tcp ouvrir telnet 80 / tcp ouvrir http 139 / tcp ouvrir netbios-ssn 515 / tcp open 631 / tec open ipp 9100 / tcp open adresse MAC: 00: 00: 48: 0D: EE: 8)

Quelqu'un peut-il m'aider dans ce domaine.


0 commentaires

3 Réponses :


3
votes

Vous devez mettre l'expression de recherche entre guillemets, par exemple

$('.wrap .view_all_que:contains("' + question + '")').parent('li').removeClass('current-question');


0 commentaires

1
votes

Vous avez manqué d'ajouter des guillemets autour de la question variable. essayez comme ceci.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<div class="wrap">
    <ul>
        <li class="current-question">
            <i class="fa fa-bookmark" aria-hidden="true"></i>
            <span class="question-dot"></span>
            <a class="view_all_que">
                <p>A penetration tester is conducting a port scan on a specific host. The tester found several ports opened that were confusing in concluding the Operating System (OS) version installed. Considering the NMAP result below, which of the follow is likely to be installed on the target machine by the OS? Starting NMAP 5.21 at 2011-03-15 11:06 NMAP scan report for 172.16.40.65 Host is up (1.00s latency). Not shown: 993 closed ports PORT STATE SERVICE 21/tcp open ftp 23/tcp open telnet 80 /tcp open http 139/tcp open netbios-ssn 515/tcp open 631/tec open ipp 9100/tcp open MAC Address: 00:00:48:0D:EE:8</p>
            </a>
        </li>
                                        
    </ul>
</div>

var question = 'A penetration tester is conducting a port scan on a specific host. The tester found several ports opened that were confusing in concluding the Operating System (OS) version installed. Considering the NMAP result below, which of the follow is likely to be installed on the target machine by the OS? Starting NMAP 5.21 at 2011-03-15 11:06 NMAP scan report for 172.16.40.65 Host is up (1.00s latency). Not shown: 993 closed ports PORT STATE SERVICE 21/tcp open ftp 23/tcp open telnet 80 /tcp open http 139/tcp open netbios-ssn 515/tcp open 631/tec open ipp 9100/tcp open MAC Address: 00:00:48:0D:EE:8';

$('.wrap .view_all_que:contains("'+question+'")').parent('li').removeClass('current-question');
$('.wrap .view_all_que:contains("'+question+'")')


0 commentaires

1
votes

Vous avez manqué les doubles guillemets! Ajoutez-les et cela fonctionnera comme vous le souhaitez

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<div class="wrap">
    <ul>
        <li class="current-question">
            <i class="fa fa-bookmark" aria-hidden="true"></i>
            <span class="question-dot"></span>
            <a class="view_all_que">
                <p>A penetration tester is conducting a port scan on a specific host. The tester found several ports opened that were confusing in concluding the Operating System (OS) version installed. Considering the NMAP result below, which of the follow is likely to be installed on the target machine by the OS? Starting NMAP 5.21 at 2011-03-15 11:06 NMAP scan report for 172.16.40.65 Host is up (1.00s latency). Not shown: 993 closed ports PORT STATE SERVICE 21/tcp open ftp 23/tcp open telnet 80 /tcp open http 139/tcp open netbios-ssn 515/tcp open 631/tec open ipp 9100/tcp open MAC Address: 00:00:48:0D:EE:8</p>
            </a>
        </li>
                                        
    </ul>
</div>
var question = 'A penetration tester is conducting a port scan on a specific host. The tester found several ports opened that were confusing in concluding the Operating System (OS) version installed. Considering the NMAP result below, which of the follow is likely to be installed on the target machine by the OS? Starting NMAP 5.21 at 2011-03-15 11:06 NMAP scan report for 172.16.40.65 Host is up (1.00s latency). Not shown: 993 closed ports PORT STATE SERVICE 21/tcp open ftp 23/tcp open telnet 80 /tcp open http 139/tcp open netbios-ssn 515/tcp open 631/tec open ipp 9100/tcp open MAC Address: 00:00:48:0D:EE:8';

$('.wrap .view_all_que:contains("'+question+'")').parent('li').removeClass('current-question');


0 commentaires