Reputation: 2091
jQuery functions like datepicker()
, val()
, or hide()
etc. don't work. I have no idea why is that so, because alert before the command works, as well as jQuery variable is defined.
What libraries I have loaded?:
<script type="text/javascript" src="{{ asset("bundles/admin/js/plugins/jquery-1.7.min.js") }}"></script>
<script type="text/javascript" src="{{ asset("bundles/admin/js/plugins/jquery.flot.min.js") }}"></script>
<script type="text/javascript" src="{{ asset("bundles/admin/js/plugins/jquery.flot.resize.min.js") }}"></script>
<script type="text/javascript" src="{{ asset("bundles/admin/js/plugins/jquery-ui-1.8.16.custom.min.js") }}"></script>
<script type="text/javascript" src="{{ asset("bundles/admin/js/custom/general.js") }}"></script>
<script type="text/javascript" src="{{ asset("bundles/admin/js/custom/dashboard.js") }}"></script>
Where does the function I'm trying to run resides? Inside dashboard.js
file, the code looks like this:
jQuery(document).ready(function(){
jQuery('#datepicker').hide();
});
And the datepicker field is:
<input type="text" id="dateBir" name="dateBir" id="datepicker" />
I've tried that with $ sign instead of jQuery variable, but nothing happens. Alert before the function works, jQuery is defined, just like I said at the beginning. What's wrong?
Upvotes: 0
Views: 54
Reputation: 130
You have two id's on your input, change datepicker to be a class?
<input type="text" id="dateBir" name="dateBir" class="datepicker" />
Can you then run from developer console?
jQuery('.datepicker').hide();
jQuery('.datepicker').css('display','none');
jQuery('#dateBir').css('display','none');
Upvotes: 1