I try to use jQuery if title input into my control panel have %like% some words
like
I love to eat apple
and I need to find love, apple
if found let jQuery select from dropdown menu value id 5
$("#HowYouKnow option").each(function() {
if($(this).text() == theText) {
$(this).attr('selected', 'selected');
}
});
I found this code that when found text = text I need it %like% text with array to use many text ('text1','text2')
If you want to select dropdown item based on input use this code:
if($("#input").val().match(/love|apple/)) {
$("#select").val(5);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.