JQuery.Show () not working with server management?

I have 2 html TR that I do them runat="server"and visible="false", and I have a drop-down list calledcitiesDropDownList

$(document).ready(function() {
$('#<%=citiesDropDownList.ClientID %>').change(function() { ValidateCity(); });
});

and when changing this drop-down list I check if its text matches the line i 2 tr, as shown below

function ValidateCity() {
        if ($('#<%= citiesDropDownList.ClientID %> :selected').text() == identity_CityOther)   {
            $('#<%= otherCityTR.ClientID %>').show();
            $('#<%= areasTR.ClientID %>').show();
        }
        var city = $('#<%= citiesDropDownList.ClientID %>').val();
        return IsValid((city.length != 0), '#<%= cityDiv.ClientID %>', identity_CityRequired);
    }

.show () does not work at all, and I am not the reason .. can someone lead me to the problem?

FYI: I tried $('#<%= otherCityTR.ClientID %>').show('slow');as well $('#<%= otherCityTR.ClientID %>').css('visibility', 'visible');, but it doesn't work either ...

+1
source share
3 answers

visible="false" means it doesn't even appear on the page, so your selectors don't find any elements.

visible="false" style="display: none;", , .

+9

visible = "false" , . display: none, display: block javascript.

+3

Remove visible = false from the control server, as this stops displaying the control on the page, or sets the CSS style to display: none, or hides the required controls in javascript.

+1
source

Source: https://habr.com/ru/post/1763309/


All Articles