Why is my jquery input mask not working?

一世执手 提交于 2019-12-02 02:51:24

jQuery selectors follow the standard CSS syntax, so the space in the middle of your ID is actually being treated as a descendant selector. Make your life easier: when dealing with jQuery, keep your IDs and classes limited to alphanumerics, hyphen and that's about it.

To clarify: there is a quote/escape syntax in jQuery, but IMHO it's too annoying to deal with, hence I'm not even giving an example of it.

remove the space from the ID and then try this

jQuery(function ($) {
    $("#POIName").mask("99/99/9999");
});
Josh Mein

Spaces are not valid in ID attributes. You should change your id to $("#POIName") and update your html as well.

Jquery-ids-with-spaces is a similar question that you may find intersting.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!