I don’t know if it is possible! Maybe my thought is also wrong. I want to invoke a search corresponding to all links in my WordPress blog.
I am using an Ajax call for my other search in this site. How can I retrieve a linking text from hypertext tag in html.
eg: <a href='www.example.com'>demo</a>
.here i want to get ‘demo‘ as input.
Thanks.
Try this:
What the
search
function does is it loops through the list of strings and if any have theterm
in it (indexOf
), then it will get pushed into an array which is then returned. If there are no matches, it will returnnull
.You could use
Then all anchor text elements will be stored in the array $matches.