I
I
Ilya Famin2020-04-30 07:30:39
JavaScript
Ilya Famin, 2020-04-30 07:30:39

Tag exceptions from array after search script applied?

Link to the source code of the site: https://jsfiddle.net/sqvy9tw2/1/
You need to exclude NEW MATERIALS from the
script code array:

function myFunctionmat() {
                                    var input, filter, section, aside, a, i;
                                    input = document.getElementById("mySearch");
                                    filter = input.value.toUpperCase();
                                    section = document.getElementById("materials");
                                    aside = section.getElementsByTagName("aside");
                                    for (i = 0; i < aside.length; i++) {
                                        a = aside[i].getElementsByTagName("a")[0];
                                        if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
                                            aside[i].style.display = "";
                                        } else {
                                            aside[i].style.display = "none";
                                        }
                                    }
                                }

                                function myFunctionmat() {
                                    var input, filter, section, aside, a, i;
                                    input = document.getElementById("mySearch");
                                    filter = input.value.toUpperCase();
                                    section = document.getElementById("materials");
                                    aside = section.getElementsByTagName("aside");
                                    for (i = 0; i < aside.length; i++) {
                                        a = aside[i].getElementsByTagName("p")[0];
                                        if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
                                            aside[i].style.display = "";
                                        } else {
                                            aside[i].style.display = "none";
                                        }
                                    }
                                }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question