I have a page where Ids are changed to ctl00_MainContent_txt_insurance
. In this case I cannot use the actual Id as $("#txt_insurance")
. so what I did was to use $("#<%= txt_insurance.ClientID %>")
, which works fine now.
But now if I want to replace the above ID and show it I did this:
divToChangeVisible = $("#<%= txt_insurance.ClientID %>");
divToChangeVisible.replace("txt_", "val_").show();
This will get me an object and throws an error saying cannot be replaced. Is there a way to get txt_insurance
as Id without having to replace ctl00_MainContent_
?
Edit :: If I do $("#<%= txt_insurance.ClientID %>").attr('id')
this will again return the dynamic id...