Question: Client id of every element from the sharepoint page changes sometimes.  

Can anybody please tell me why and on which instance it changes???

Answer: 
> 
> jQuery is fantastic! It makes client-side development faster and
>  countless plug-ins are available for just about every need. Using
>  jQuery with Asp.NET Web-Forms gets aggravating when dealing with
>  nested server controls. ClientID’s get appended when using ASP.NET
>  Master Pages. Objects in JavaScript tend to look like this:
>  ctl00\_m\_g\_aaf13d41\_fc78\_40be\_81d5\_2f40e534844f\_txtName
>  The difficulty of the issue above is that, in order to get the element txtName, It’s necessary to know the full “path”. It’s quite
>  aggravating to refer to get the object using the method below:
>  document.getElementByID('ctl00\_m\_g\_aaf13d41\_fc78\_40be\_81d5\_2f40e534844f\_txtName');
>  This becomes a big problem when developing server controls or web parts that may be used in a typical ASP.NET application or SharePoint.
>  You cannot hard-code the path above if you don’t know the full path of
>  the control.
> 
> 
> Fortunately, there are a few ways to get around this. There are three, in particular, I will mention. The first is the jQuery
>  equivalent to the standard JavaScript method:
>  document.getElementById("<%=txtName.ClinetID%>");");
>  This can be done in jQuery by using:
>  $("#'<%=txtName.ClinetID%>");");
>  The second jQuery method does not require server tags. This method searches through all tags and looks for an element ending with the
>  specified text. The jQuery code for this method is shown below:
>  $("[id$='\_txtName']");
>  There are, of course, drawbacks to both methods above. The first is fast, but requires server tags. It’s fast, but it just looks messy.
>  Also, it will not work with external script files. The second
>  alternative is clean, but it can be slow. As I said earlier, there are
>  several other alternatives, but these two are the ones I find myself
>  using the most.
> 
> 
> The third registering Javascript in C# code behind.
> 
> 
> 

```
Page.ClientScript.RegisterStartupScript(GetType(), "saveScript",

String.Format("function EnableSave( isDisabled )"+

"{{ var saveButton = document.getElementById(\"{0}\");"+

"saveButton.disabled=isDisabled;}}", btnSave.ClientID), true);

```

> 
> Do not forget to call this script after controls have been loaded, I mean after Controls.Add(); in CreateChildControls method while
>  developing webparts.
> 
> 
>
$('input[title="Name"]')

Look at the page source and get the value of the title property - works every time.