0

Hi i just want to ask if this is possible, if you click the image with a anchor link it will automatically add text and search it on my iframe src search bar,

HTML

<!-- When you click this image -->
    <a href="">
    <img src="img/hey.jpg">
    </a>

<!-- it will add any text and search it on my search bar on my iframe-->

    <input type="text" class="form-control" placeholder="Search" name="s" id="s">
IsThisJavascript
  • 1,726
  • 2
  • 16
  • 25
  • Add what text? Can you give an example? – IsThisJavascript Apr 19 '18 at 08:06
  • depends on the search DOM element - but because you're loading an external site into yours, you have no real control of what you're loading. That being said a Google search got me here: https://stackoverflow.com/questions/536538/pass-value-to-iframe-from-a-window#536624 – treyBake Apr 19 '18 at 08:08
  • @IsThisJavascript Hi! :) for example whats inside the href tag example href="THISISSOMETHING" once you click the anchor link THISISSOMETHING will be pasted on the search bar and search it right away – Filipino Brigade Apr 19 '18 at 08:09
  • @ThisGuyHasTwoThumbs Hi this is the scenario i know this is a dumb but i have a search page that im calling using an iframe on my menu, but the search page is just on my website (im just using the iframe so when the user search they will not redirect to another page, it will just show up on my menu) so what im trying to do, for example i have a blog post with an image once i click the image with the anchor it will pass the text or info from the anchor inside href="" to the search bar and search it' – Filipino Brigade Apr 19 '18 at 08:13
  • is the search bar inside the actual iframe or outside? – treyBake Apr 19 '18 at 08:14
  • @ThisGuyHasTwoThumbs inside the iframe – Filipino Brigade Apr 19 '18 at 08:18
  • this may be what you're after: https://stackoverflow.com/questions/1452871/how-can-i-access-iframe-elements-with-javascript#1452885 – treyBake Apr 19 '18 at 08:18

0 Answers0