I am trying to create a drop down (for a personalised chrome extension) that will take add a class to tick boxes (so they are selected) if their title matches what is in the text box (the data is a long string split by commas).
However I am trying to make it so that it only searches for the text and not more suchs as:
If I am searching for: "GDPR"
It currently finds "GDPR" and "GDPR Compliant".
I need it to show only "GDPR".
//adds the drop down
jQuery('body').prepend('<div style="border: 3px solid black;position:
absolute;width: 80%;top: 10%;left: 10%;right: 10%;background-color:
rgba(225,225,225,0.95);z-index: 1000;cursor: pointer;padding: 1%;">Input your
options comma deliminated: <input class="options_text" style="float:right;
padding-left:5px; width:50%;"><br/><input type="submit"
class="options_select"></div>')
//adds class
jQuery('.options_select').click(function(){
x = jQuery('.options_text').val().split(",")
for (i = 0; i < x.length; i++) {
s = '.card_answer .content:contains('+x[i]+')'
if(x[i] == jQuery(s).val()){
jQuery(s).parent().parent().addClass('selectable_selected')
}
}
}
)