Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8536891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:46:16+00:00 2026-06-11T10:46:16+00:00

I have 2 HTML files. In First.html I want to include Second.html. When i

  • 0

I have 2 HTML files.

In First.html I want to include Second.html. When i click on Login button , I was uanble to get the data or control from the in js file.

First.html

<!DOCTYPE html>
<html>
  <head>      
    <title>Insert title here</title>    
    <script type="text/javascript" src='js/jquery.js'></script>        
    <script type="text/javascript" src="js/first.js"></script>
</head>
<body>  
     <div id="content"></div>
</body>
</html>

Second.html

<!DOCTYPE html>
<html>
<head>  
    <script type="text/javascript" src='js/jquery.js'></script>
</head>     
<body>      
<div>
    <div data-role="fieldcontain">
        <label id="luserid" ><strong>UserId : </strong></label>
        <input type="text" name="userid" id="userid" value="" class="logon" placeholder="Username" required/>
    </div>
    <div data-role="fieldcontain">
        <label id="lpassword"><strong>Password :</strong></label>
        <input type="password" name="password" id="password" class="logon" value="" placeholder="Password" required/>
    </div>
    <div class="ui-body">
        <fieldset class="ui-grid-a">                            
                <div class="ui-block-a"><a data-role="button" id="loginbtn" data-theme="b">Login</a></div>                          
        </fieldset>
    </div>              
</div>
</body>
</html>

first.js

$(document).ready(function(){   
      $('#content').load('login.html');
      $("#loginbtn").click(function () {
          alert("Inside Login");
      });        
 });

Help me out on this….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:46:17+00:00Added an answer on June 11, 2026 at 10:46 am

    You should attach the click handler inside a load callback:

    $(document).ready(function(){   
      $('#content').load('login.html', function() {
         $("#loginbtn").click(function () {
          alert("Inside Login");
         });        
      }
    });  
    

    The reason your code fails, is because the #loginbtn element may not yet exist when you try to set the click handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First I have a PHP file that gets data and file from a HTML
I have 3 files 1) show_createtable.html 2) do_showfielddef.php 3) do_showtble.php 1) First file is
I have some html files and want to extract only lines with containing these
I have some html files that I want to convert to text. I have
I have some html files with their own css. I want to use them
In my app I have the WebView which shows html files. So I want
I want to insert data from included file and create HTML-elements automatically. In data.php
I have IIS running under Windows XP. I have .html files with classic ASP
I have multiple HTML files which vary only by a little - a few
i have 20 HTML files ok ? i am going to shake the iphone

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.