jQuery addClass example

Change class name on click in jQuery

by Palaghiu Marian

HTML

<html>
    <head>
        <title></title>
        <script type="text/javascript"  src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
        <style>
         
        </style>
        <script>
            $(function() {
                $("#load").click(function() {
                    var new_url = $("#url").val();
                  var new_os = $("#platform").val();

                    // Checks that the user typed "http://" or not
                    if(new_url.substr(0,7)!="https://masterfortnite.com/player/pc/")
                        new_url = "https://masterfortnite.com/player/pc/"+new_url;

                    $("#main_frame").attr("src", new_url);
                });
             });
        </script>
    </head>
    <body>
        <div id="container">
            <div id="sidebar">
               
                <input type="text" name="url" value="USERNAME" id="url">
                <input type="button" value="CHECK" id="load">
                <br><br>    
            </div>
            <div id="netframe">
                <iframe height="100%" width="100%" class="netframe" src="pullsite.php" id="main_frame"></iframe>
            </div>
        </div>
    </body>
</html>

CSS

body, html
            {
                 height: 100%;
  overflow: auto;
            }


iframe {
  
border: 0; 
  position:fixed; 
  top:0; 
  left:0; 
  right:0; 
  bottom:0; 
  width:100%; 
  height:100%;
  margin-top:-50px;
 


  
}

 

            #sidebar {
                
              height: 9.5%; 
                width: 100%;
              background:#007b33;
              text-align:center;
               z-index:999;
              position:absolute;
             
            }

#url {
  width: 250px;
  height: 40px;
  vertical-align:center;
  margin-top:17px;
  background:#fff4;
  border: 1px solid #fff6;
  color: white;
  font-size:16px;
  font-weight:bold;
  padding-left:10px;
}

#load {
  height: 40px;
  background:#0004;
  border: 1px solid #fff6;
  color: white;
  font-size:16px;
}