Victor
Victor

Reputation: 1271

Datepicker inside hidden divs

I have certain divs that are hidden using jquery. Some of the divs have date input fields handled by datepicker.

Anytime I load my page, the browser gives this error:

Error: Unable to get value of the property 'inline': object is null or undefined

Datepicker is defined onReady

$(".datepicker").datepicker({
    inline: true
});     

I tried to hide the divs using .hide()/show() and addClass('hidden'). but datepicker gives this error anyway.

Is there a way to solve this problem?

Upvotes: 0

Views: 2795

Answers (2)

hwlau
hwlau

Reputation: 75

I have the same problem and I solved it by replacing the updated jQuery css.

version : jquery-1.7.js
css: jquery-ui-1.7.2.custom.css

I resolved it by replacing the updated css:

css: jquery-ui-1.8.21.custom.css

Upvotes: 1

marcocamejo
marcocamejo

Reputation: 828

JQuery datepicker does not have the inline option.

If you want a datepicker inline, you must call datepicker() on a div, instead of an input.

<script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
</script>

Date: <div id="datepicker"></div>

Upvotes: 0

Related Questions