I am returning a list of Users/Records that I follow in Chatter. Ultimately, what I want to do is display the list in a webpage and simply click on a User or Record and I will stop following them.

So I've returned the list and I figure if I remove the parent.id or set it to null and update the record, that should do the trick. I know it might not be perfect but I want to try it anyway.

<apex:repeat value='{!Admin}' var="f">
            $('<span>').addClass('parent-span').append('<b>Parent Id: </b>'  + '{!f.parentid}' + '</br></br>' )

I need to pass the parentId from 'parent-span' into a function but I'm not really sure how to proceed. Would anyone have any suggestions?

Something like this perhaps?

var parentId;
   parentId = $(this).attr(??);

1 Answer 1


Try to set the specific ID to the span itself:

    jQuery('<span id="parentId-{!f.parentid}">').addClass('parent-span').append('<b>Parent Id: </b>'  + '{!f.parentid}' + '</br></br>' )

And then get it in the jQuery click listener:

var parentId;
jQuery(".parent-span").on("click", function(){ 
    parentId = jQuery(this).attr(id);

Update: to pass this id to the controller use a simple actionFunction and apex:param:


public String currentParentId { get; set; }

public MyClass{
    currentParentId = '';

public PageReference myMethod(){
    System.debug(' passed id: ' + currentParentId);
    return null;


<apex:actionFunction name="processId" action="{!myMethod}" reRender="none">
    <apex:param name="p1" assignTo="{!currentParentId}" value=""/>

    jQuery(".parent-span").on("click", function(){ 
  • Brilliant, that works perfectly!! cheers mast0r
    – Daft
    Oct 10, 2013 at 11:19
  • 1
    @Daft Updated my answer, check it out. Oct 10, 2013 at 11:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .