I'm trying to search a particular word on the input field and perform if/else condition accordantly. for an example input field can be "iPhone 6" or "Apple iPhone 5" or " Samsung A7" o "S9 Samsung" etc. Please help me find word "iPhone" or "Samsung" from the input field apply if/ else condition.
<input type="text" id="ModelNo" />
<script>
var Model_Validation = document.getElementById("ModelNo").value;
var Model_1 = "iPhone";
var Model_2 = "Samsung";
function test() {
if (Model_Validation == Model_1) {
} else if (Model_Validation == Model_2) {
} else {}
}
</script>
I doubt which logic to use in if condition as well. hope my question is clear.