The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Copy element and place it elsewhere.

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #35578

    Basically I want to make a contact form, there is an area that says “Logged in as *username*” and basically I want to know how to capture the name of the person and put it in an input box.

    Here’s the code:

    • Logged in as User

    It’s in a strong element so if that helps.

    I don’t want the element moved, I want the individual’s username ‘captured’ and placed into an input box..


    I apologize if I wreck your indentation. This is the easiest way to solve your problem and will work with older web browsers. the word in the “value=” part is what will be displayed in the text box.

    • Logged in as

    the bare minimum code needed for a text box is this ‘‘ but that would be useless if the textbox contents need to be used.


    @MaikelMaikel, with jQuery I would do something like this:

    var username = $('.conl').find('strong').text();
    $('#input-box-id').attr('value', username);
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.