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 754323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:59:56+00:00 2026-05-14T14:59:56+00:00

So I am trying to replicate Facebook’s picture tagging functionality, and I have the

  • 0

So I am trying to replicate Facebook’s picture tagging functionality, and I have the functionality that onClick, a box is created and there is a comment box.

Now the issue is that I want to be able to (without doing any back-end processing) take the input from the input field and add it in some form to the underlying image area that they have selected. I would also like to add a small image to that area, that shows that a comment is there.

How do I do that?

See the code below for what I have for the comment box:

<script type="text/javascript">

    $(function() {
            var tag_box = $("<div>").appendTo("body").css({
                "width": "40px",
                "height":"40px",
                "border":"4px solid #000000",
                "position":"absolute",
                "display":"none", 
                "padding":"15px"
                });

        var comment_box = $("<form action='#'><input id='comment' type='text' name='comment' placeholder='Add comment'></form>").appendTo(tag_box).css({"position":"absolute"});            

        $("#image-wrapper").live('click', function(e){
            tag_box.css({
                "left": e.pageX - 40,
                "top": e.pageY - 40, 
                "display": "block"
                })
            .after(comment_box.css({
                "left": e.pageX - 65,
                "top": e.pageY + 40
            }));

            });

        });


</script>
<body>    
<div align="center">  

    <img src="images/test.gif" width="760" height="182" alt="test" id="image-wrapper">

    </div>
</body>

Now…whenever the user presses enter, the info in the comment box is appended to the URL like so:

.html?comment=comment value#

Thanks

Edit: My bad…I left out HTML…I have appended it to the script tag above.

  • 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-05-14T14:59:57+00:00Added an answer on May 14, 2026 at 2:59 pm

    This may not be the best solution, but do give it a try 🙂

    <script type="text/javascript">
        $(function() {
    
            var tag_box = $("<div class=\"comment-box\"></div>").css({
                    "width": "40px",
                    "height":"40px",
                    "border":"4px solid #000000",
                    "position":"absolute",
                    "padding":"15px"
            });
    
            var comment_box = $("<form action='#'><input id='comment' type='text' name='comment' placeholder='Add comment'></form>").appendTo(tag_box).css({"position":"absolute"});            
    
            $("#image-wrapper").live('click', function(e){
                if($(this).parent().find('.comment-box').length === 0) {
                    $(this).parent().append(tag_box).css('top',182).find('input#comment').focus();
                }
                return false;
            });
            $(".comment-box").
                live('mouseenter mouseleave', function(event) {
                    if(event.type == 'mouseout') {
                        $(this).remove();
                    }
                })
                .find('form').live('submit',function() {
                    var comment = $(this).find('input#comment').val();
                    var wrapperOffset = $("#image-wrapper").offset();
                    var commentBlock = '<div class="comment-block" style="position:absolute;color:white; display:block; float:left; clear:both; height:auto; width:760px; background:red;">' + comment + '</div>';
                    var posTop = wrapperOffset.top;
                    $(commentBlock).css({
                        'width' : 760,
                        'top' : posTop,
                        'left' : wrapperOffset.left,
                        'z-Index' : 100
                    });
    
                    if($("#image-wrapper").parent().find('.comment-block').length > 0) {
                        var lastBlock = $("#image-wrapper").parent().find('.comment-block:last');
                        var lastBlockOffset = $(lastBlock).offset();
                        $(commentBlock).insertAfter($(lastBlock)).css('top', lastBlockOffset.top + $(lastBlock).height() + 4);
                    } else {
                        $(commentBlock).insertBefore('#image-wrapper');
                    }
    
                    $(this).parent().parent().find('.comment-box').remove();
                    $(this).get(0).reset();
                    return false;
                });
        });
    </script>
    <style>
    #image_container { display:block; height:auto; width:760px;margin:0 auto; background:yellow;}
    </style>
    <body>
    <div align="center">
        <div id="image_container">
            <img src="/images/image1.jpg" width="760" height="182" alt="test" id="image-wrapper">
        </div>
    </div>
    </body>
    

    Update :

    <style>
    #image_container { display:block; height:auto; width:760px;margin:0 auto; background:yellow;}
    </style>
    <body>
    <div align="center">
        <div id="image_container">
            <img src="/images/image1.jpg" width="760" height="182" alt="test" id="image-wrapper">
        </div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to replicate the functionality of facebook's status update where tags within the
I'm trying to replicate the clear queue functionality of the iPod application, however I
I'm trying to replicate the Gmail Notifier popup. It both fades in (Opacity) and
I am currently trying to replicate my IndexController to a BetaController. I want Beta
I am trying to replicate the UNIX program wc in haskell. To make this
I am trying to replicate this query using zend framework: SELECT activitytype.description, activity.datecompleted FROM
I am trying to replicate, with my own code, the history-sniffing demo seen on
i am trying to replicate this jcrop demo . Everything works fine except, my
I'm trying to replicate the Convert.ToBase64String() behavior in Ruby. Here is my C# code:
I'm trying to convert my once fully functional app from using the ancient feed

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.