This is really strange, and for several hours I hit my head about it and I canโt understand.
I use jQuery to hide some elements in the form (labeled with the .read-only class) and show other elements (labeled with the .edit-version class).
Basically, the user clicks on the edit link, and inside the parent of this link, read-only objects are hidden and the editing elements (inputs) are displayed. It works great.
The problem arises in the response of the server, which passes the opposite case. It finds a div that places the form, and hides the editing versions and displays read only. Other than that, no. Here is the code:
host = $('#employee-card-49'); $('.edit-version', host).hide(); $('.read-only', host).show();
I checked that it received the correct div ( #employee-card-49 ), and is the correct element, and this is the only element with this identifier on the page.
I checked that $('.edit-version', host).length correct. It returns 3, indicating that it detects three elements.
I checked that every returned item from $('.edit-version', host) correct. I can get their properties.
Javascript errors do not appear, but calls to hide () and show () just don't change the display property at all. I even tried calling css('display', 'none') no avail.
If I change the call to call $ ('. Edit-version'). hide (), it works, but it will affect other divs on the page that I don't want to influence.
Any help would be appreciated.