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

  • Home
  • SEARCH
  • 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 8556233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:18:01+00:00 2026-06-11T15:18:01+00:00

i am trying to built a popUp box in my page which asks userName

  • 0

i am trying to built a popUp box in my page which asks userName and Alerts that user.. here is my html code..

<a class="pop-up-link" href="#" title="View Pop Up" onClick="popUp()">Click Here</a>

    <div class='popup'> <a href='#' title="Close" class='close'><img src='close.png' alt='close' height="20" width="20" /></a>
        <div class="pop-heading">
            <h3>Pop Up</h3>
        </div>
        <div class="pop-info">
        </div>
    </div>

And then i have jquery code like

function popUp()
{
    var htmlString = "";
    var height = $(document).height();
    var width = $(document).width();
    var spanHeight = $('.popup').height();
    var spanWidth = 500;

    $('.pop-up-link').click(function() { 
        $(this).next()
            .css({ "top" :  height/2 - spanHeight/2 })
            .css({ "left" : width/2 - spanWidth/2 })
            .fadeIn(100);
    });

    $(".close").click(function () {
        $('.pop-up-link').next().fadeOut(100);
    });

    htmlString+='<input type="text" id="User" name="User"/>';
    htmlString+='<input type="button" value="Login" onclick="userLogin()">';
    $(".pop-info").html(htmlString);
}

function userLogin()
{
 alert($('#User').val());
}

But the alert box doesnt get any value. Then i had tried to put some value(to check its working), like $('#User').val('hello'); in userLogin function. But it also is not working. Ithink that input field is not accessable..
Can anyone describe how could i take the value in that User textbox?

  • 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-11T15:18:02+00:00Added an answer on June 11, 2026 at 3:18 pm

    Here is the answer

    <a class="pop-up-link" href="#" title="View Pop Up">Click Here</a>
    
    <div class='popup'> <a href='#' title="Close" class='close'><img src='close.png' alt='close' height="20" width="20" /></a>
        <div class="pop-heading">
            <h3>Pop Up</h3>
        </div>
    

    here is jquery

    $('.pop-up-link').click(function() {
        var htmlString = "";
        var height = $(document).height();
        var width = $(document).width();
        var spanHeight = $('.popup').height();
        var spanWidth = 500;
    
        $('.pop-up-link').click(function() { 
            $(this).next()
                .css({ "top" :  height/2 - spanHeight/2 })
                .css({ "left" : width/2 - spanWidth/2 })
                .fadeIn(100);
        });
    
        $(".close").click(function () {
            $('.pop-up-link').next().fadeOut(100);
        });
    
        htmlString+='<input type="text" id="user" name="User"/>';
        htmlString+='<input type="button" value="Login" class="login">';
        $(".pop-info").html(htmlString);
    });
    
    $(document).on('click', '.login', function () {
         alert($(this).prev().val());
    }​);
    

    Check live example on JSFIDDLE​

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

Sidebar

Related Questions

I have built a feedback page.I am trying to send mail from the page.The
I'm trying to subclass the built-in file class in Python to add some extra
I'm trying to build a Javascript listener for a small page that uses AJAX
I am trying to build a simple div based popup which can be used
I'm trying to create my own modal window (the built in popup manager won't
I am trying to replace placeholders in a text file, with html elements built
I'm trying to create a web application that will allow a user to post
I am trying to create a popup from my WPF application which shows a
I am currently trying to implement the built-in Silverlight 3 validation against objects that
Hi I'm trying to build a layout where some shapes will popup every 2

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.