In my asp.net app, I have multiple hrefs with dynamic Ids that all share the same CssClass called MyClass.
I am looking to hide these buttons based on a certain condition.
Initially, I used the .ready function:
$(document).ready(function() {
if(condition)
$('.MyClass').css("display","none");
});
However, the issue arises when there is a postback event since document.ready does not execute in such cases.
During postback, the button becomes visible again even though the code is placed inside the .ready function.
Is there a way to ensure that this line of code $('.MyClass').css("display","none"); persists?
I attempted to use the .live() method on button load but it did not work as expected.
Do you have any suggestions or ideas on how to handle this situation?
Thank you in advance.