我在jquery中的引号有问题

时间:2019-06-18 09:56:43

标签: jquery html

我想在当前问题上动态添加类,因为我已经在jquery中创建了一个函数,但是与此同时,我遇到了一些语法错误问题。

我在下面给出了我的代码。

function current_question(question,class_name){
    var questionn = question;
    $('.wrap .view_all_que:contains("'+questionn+'")').parent('li').addClass(class_name);
}

var question = 'It's Risk Management, how is the term "likelihood" related to the concept of "threat?"';        

current_question(question,'current-question');        
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div>
	<ul>
		<li class="">
            <i class="fa fa-bookmark" aria-hidden="true"></i>
            <span class="question-dot"></span>
            <a class="view_all_que incorrect-answer">
                <p>It's Risk Management, how is the term "likelihood" related to the concept of "threat?"</p>
            </a>
        </li>
	</ul>
</div>

有人可以帮我吗?

0 个答案:

没有答案