Load .html into div by using a search bar - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:html

Description

Load .html into div by using a search bar

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>html</title> 
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script> 
 </head> /*from w w w.j  a  va2 s .c o  m*/
 <body> 
  <input type="search" id="search"> 
  <input type="button" id="button" name=""> 
  <div> 
  </div> 
  <script type="text/javascript">
    $("#button").on('click', function(e){
        $('div').load($("#search").val() + ".html");
    });

      </script>  
 </body>
</html>

Related Tutorials