title: JQuery Slider value returns [object object]
body: <p>I'm trying to get the initial value of a slider once loaded. It appears that in IE9 <code>$('#slideramount').slider('option','value')</code>  returns [object object] randomly instead of the actual value.</p>
  
  <p>I'm using jquery 1.8.0, and jquery-ui 1.9.1</p>
  
  <p>Code:</p>
  
  <pre><code>&lt;div id="slideramount" class="slider"&gt;&lt;/div&gt;
  
  $("#slideramount").slider({
      range: "max",
      min: 100,
      max: 1000,
      step: 50,
      value: 1000,
      slide: function (event, ui) {
          //do stuff
      }
  });
  
  //sometimes returns the value, other times returns [object object]
  console.log($('#slideramount').slider('option','value'));
  </code></pre>
  
  <p>It only seems to be happening in IE9 like 50% of the time. Chome/FF/IE10 work fine.</p>
  
  <p>I'm testing IE9 by running IE10 in IE9 Browser/Document mode, not sure if that would be fudging up the results?</p>
  
  <p>It looks like the slider doesn't load properly when it return [object object] but I'm not sure why. I've checked to make sure jqueryui is loaded, and such. I'm running out of ideas.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I've changed around the code so that it creates the sliders on <code>$(document).ready()</code> then try and retrieve the value <code>console.log($("#slideramount").slider("value"));</code> on <code>$(window).load()</code>.</p>
  
  <p>When it fails I get a <strong>Cannot call methods on slider prior to initialization</strong> so it's like the slider doesn't create itself properly. Not sure why, but it still only fails sometimes in IE9.</p>
  
  <p><strong>FIXED:</strong></p>
  
  <p>So I've finally managed to fix it (it was pretty silly).</p>
  
  <p>I had the javascript in it's own file, so the HTML looked like this:</p>
  
  <pre><code>&lt;script src="/Scripts/sliders.js"&gt;&lt;/script&gt;
  
  &lt;div id="slideramount" class="slider&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I read <a href="https://stackoverflow.com/questions/11896207/jquery-slider-not-working">here</a> to "Just Add your script at the end of the document" so I moved the script under all the relevant HTML, and voila the sliders would always load. I can't believe I didn't think of that before...</p>
  
  <p>There must've been js in the script file that was referencing some DOM elements before they were loaded, even though I was loading the sliders on <code>$(document).ready()</code>.</p>