Reputation: 1031
I am trying to use :contains as a selector:
var test = jQuery(":contains('"+content_uq_name+"')").css();
console.log(test);
I am getting a jQuery error:
TypeError: a is undefined
...eChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},...
What am I doing wrong? Thanks
Upvotes: 0
Views: 137
Reputation: 33218
After your comment i suggest one solution using .each()
$("div:contains('test')").each(function() {
$(this).text("test1");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>test</div>
<div>car</div>
<div>test</div>
<div>test</div>
<div>test</div>
<div>test</div>
You have to specify the elements you want to replace text.
Upvotes: 3