I have a Html.Label in my MVC razor project which looks like :

@Html.Label("No Match", new { id = "RegExMatchResult" })

It works fine when I put "No Match" and my jquery can find it using the ID ="RegExMatchResult".

However, when I change the value into an empty string:

@Html.Label("", new { id = "RegExMatchResult" })

JQuery can't find the label using ID ="RegExMatchResult". I have tested both ways and check the page source and it corresponds to what I said above (no ID when value is empty)...

Does anyone know why it does that and what I solution for this?

Related posts

Recent Viewed