Jquery Selector Not Working When Element Contains Dot In Tag Name
Solution 1:
I think you should escape the dot with a double-backslash: $("#Department\\.DeptName")
See here.
Solution 2:
You are trying to access the #Department
with a class DeptName
. You should escape with two backslashes (as Joril said).
See JQuery Selectors for more info.
Solution 3:
Alternative syntaxes like $("input[name='department.deptname']")
will work if you have control over writing jQuery. I am using Spring MVC with Kendo and thus I don't have access to jQuery code. Spring MVC <form>
tag automatically puts .
whereever applicable. E.g. if the user has Address.. thus field city will become user.address.city
(or address.city
). And if I break spring MVC into multiple forms then it messes up my back-end logic. It also scatters what should have been a single form. Another alternative is to flatten the User
object on the back-end... again, not very clean. I am not sure but Dojo worked in such a scenario.
Post a Comment for "Jquery Selector Not Working When Element Contains Dot In Tag Name"