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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:39:56+00:00 2026-05-18T08:39:56+00:00

I am building a code which displays user information on search. User information, is

  • 0

I am building a code which displays user information on search. User information, is then displayed in a fieldset, and a image, first name, last name and few profile info. is shown, and in the bottom of the fieldset, there’s a add as friend hyperlink:

<a href="#" id="aaf">add as friend</a>

Now I want to use jquery $post() method to interact with another page. I also have a hidden field inside that user fieldset which has the user id value. Now, when i create a click functionality using jquery, i am not able to access the different hidden field values. Now i want to know how to achieve this functionality? For checking if i can get the value of hidden fields inside a set of code, i did this.

$(document).ready(function () {
    $("a#aaf").bind('click', function () {
        alert($("#uid").val());
    });
});

But I’m only getting the value of first fieldset, not others. Kindly guide me in this.

EDIT: How to get it in each tag click event? I’m putting some more code here,

<?php foreach($query->result() as $row){?>
<fieldset>
    <legend>
        <?php echo $row->firstname.' '.$row->lastname;?>
    </legend>
    <img src='<?php echo $row->profile_img_url;?>'/><br>
    <a href="#" id="aaf">add as friend</a>
    <input name="uid" type="hidden" value='<?php echo $row->uid;?>' id="uid">
</fieldset>
  • 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-18T08:39:57+00:00Added an answer on May 18, 2026 at 8:39 am
    <a href="javascript:void(0)" class="aaf" id="users_id">add as a friend</a>
    

    on jquery

    $('.aaf').on("click",function(){
      var usersid =  $(this).attr("id");
      //post code
    })
    

    //other method is to use the data attribute

    <a href="javascript:void(0)" class="aaf" data-id="102" data-username="sample_username">add as a friend</a>
    

    on jquery

    $('.aaf').on("click",function(){
        var usersid =  $(this).data("id");
        var username = $(this).data("username");
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an iPhone app, which will function similarly to many restaurant finder
I am building a PHP registration form which takes the following fields for up
I am building an Facebook IFrame App. I am using the below javascript code
I am building a simple chat application under GTK+ and C, In that i
I'm building a webapp using php, ajax, javascript, mysql. I've been worring about something
I'm building an application in ruby using the sinatra framework and am having trouble
I need a straightforward, easy to understand answer on this one. I'm building a
I've just discovered the fullCalendar jQuery plugin which does pretty much everything I need
I am building my portfolio website simply using HTML , Flash , and the
Hey everyone, I'm basically new to programming. I've decided to try and get started

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.