Pass Control Id get Full Id with Holder Name

This function will support all of the jquery properties. By using this function we will get fullId including master page user control, etc.

  1. function fxj$(Id)  
  2. {  
  3.     if (Id != null)  
  4.     {  
  5.         var Control, ControlId, FinalId = '';  
  6.         var Ids = Id.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);  
  7.         if (Ids[0].indexOf(" ") > -1)  
  8.         {  
  9.             Ids = Ids[0].split(" ");  
  10.             if (Ids.length == 2)  
  11.             {  
  12.                 Control = Ids[0];  
  13.                 if (Control.charAt(0) == '.'return $(Control + ' ' + Ids[1]);  
  14.                 else  
  15.                 {  
  16.                     ControlId = $("[id$=" + Control + "]").attr('id');  
  17.                     return $('#' + ControlId + ' ' + Ids[1]);  
  18.                 }  
  19.             }  
  20.         }  
  21.         else  
  22.         {  
  23.             for (var i = 0; i < Ids.length; i++)  
  24.             {  
  25.                 Control = Ids[i];  
  26.                 if (Control.charAt(0) == '.')  
  27.                 {  
  28.                     FinalId += Control + ',';  
  29.                 }  
  30.                 else  
  31.                 {  
  32.                     var sCount = $("[id$=" + Control + "]").size();  
  33.                     //var sType = $("[id$=" + Control + "]").attr('type');  
  34.                     if (sCount > 1)  
  35.                     {  
  36.                         for (var j = 0; j < sCount; j++)  
  37.                         {  
  38.                             var sId = $($("[id$=" + Control + "]")[j]).attr('id');  
  39.                             var sSplit = sId.split('_');  
  40.                             var sOriginal = sSplit[sSplit.length - 1];  
  41.                             if (sOriginal == Control)  
  42.                             {  
  43.                                 Control = sId;  
  44.                                 break;  
  45.                             }  
  46.                         }  
  47.                     }  
  48.                     ControlId = $("[id$=" + Control + "]").attr('id');  
  49.                     FinalId += '#' + ControlId + ',';  
  50.                 }  
  51.             }  
  52.             FinalId = FinalId.substring(0, FinalId.length - 1);  
  53.             return $(FinalId);  
  54.         }  
  55.     }  
  56. }  
Usage of this function: 
  1. For disabling inside the div controls,
    1. $('#divchargecode input,select,textarea').attr("disabled"true);  
  2. For giving multiple properties at a time,
    1. fxj$('IsFoc').prop(  
    2. {  
    3.     'checked'false,  
    4.     "disabled"true  
    5. });  
  3. For hiding buttons,
    1. fx$('btnDSave').hide();  
  4. showing buttons,
    1. fx$('btnDSave').show();   
  5. perform jquery click event,
    1. fx$('btnDSave').click();   
  6. Applying css,
    1. fxj$('IsFoc').css(  
    2. {  
    3.     "border""none",  
    4.     "box-shadow""none"  
    5. });  
  7. Adding class,
    1. fxj$('IsFoc').addClass('hide');