Add attribute not working

Add attribute not working

Hello everyone, I am having some trouble adding an attribute in jquery to a select many checkbox in primefaces.

I done this function so far:

  1.     $("div.ui-chkbox-box").live("click", function(){
  2.         $parent = jQuery( $(this).parents(".ui-selectcheckboxmenu-panel") );

  3.         var classes = $(this).attr("class");

  4.         if(/ui-state-active/i.test(classes)){
  5.             var temp = $parent.attr("id").replace(/\:/g,"\\\\:");
  6.             var compId = "#" + temp.replace("_panel", "");

  7.             $id = $(compId);

  8.             if ($(compId).attr("title") === undefined){
  9.                 $id.attr("title", "Test");
  10.                 document.getElementById($parent.attr("id")).title = 'Test';
  11.             } else {
  12.                 var tempTT = $id.attr("title");
  13.                 tempTT += " " + "Teste 2";
  14.                 $id.attr("title", tempTT);
  15.             }
  16.         } else {

  17.         }
  18.     })
Debbuging it, I can see it pass thru my validation, and line 14/15, even so, it is not adding the title to the object. If I copy the snippet that adds the title to the element in the console in chrome, it works perfectly.

That is only an example, i will stick to one way to do so, that one was an attempt with both js and jquery.




Any tips are welcome =)