Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67441

What is wrong in below javascript and html code? I am trying to search blog posts through search function. a = h3[i].getElementsByTagName("a")[0];

$
0
0

What is wrong in below javascript and html code? I am trying to search blog posts through search function. After typing keywords the blog posts contain that keyword should appear.

a = h3[i].getElementsByTagName("a")[0]; 

Is there something wrong I am doing in the syntax?

I have put href="http://xxxx.com//blogs/molds/" type of links and it works but putting links in this way is giving problem

<h3><a title="WECHAT APP" target="_blank" href="<?php echo $MainSiteRoot; ?>blogs/MISSION-MOLDS/">1.&nbsp;&nbsp;MISSION MOLDS</a></h3>

This code I am using to find the post. I have put the links to blog in the h3 tag hence I edited and put h3 wherever required. But probably I have done something wrong. After typing the search keyword it is not displaying the related posts. what could I do in this? Is it a syntax error? How else can I do this?

<script>
function myFunction() {
    var input, filter, ul, h3, a, i, txtValue;
    input = document.getElementById("myInput");
    filter = input.value.toUpperCase();
    ul = document.getElementById("myUL");
    h3 = ul.getElementsByTagName("h3");
    for (i = 0; i < h3.length; i++) {
        a = h3[i].getElementsByTagName("a")[0];
        txtValue = a.textContent || a.innerText;
        if (txtValue.toUpperCase().indexOf(filter) > -1) {
            li[i].style.display = "";
        } else {
            li[i].style.display = "none";
        }
    }
}

Viewing all articles
Browse latest Browse all 67441

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>