title: How to use jQuery UI slider in a function and pass different parameters for selectors?
body: <p>I am a jQuery newbie. I've been trying to get the UI slider to work but haven't had any luck so far. What I want to do is be able to pass parameters to a function so that the parameter can be used as selectors in the slider.  One of the parameters is the slider div's id and the other is the id of the input text box that goes along with it. Oh and the UI slider is a basic step slider as shown in the demos.</p>
  
  <p>Here is the part of the HTML and JS files that concern this: </p>
  
  <p>HTML PART:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;link rel="stylesheet" href="content/jquery-ui/development-bundle/themes/smoothness/jquery.ui.all.css"&gt;
      &lt;script type="text/javascript" src="content/jquery-ui/development-bundle/jquery-1.7.2.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="content/jquery-ui/development-bundle/ui/jquery.ui.core.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="content/jquery-ui/development-bundle/ui/jquery.ui.widget.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="content/jquery-ui/development-bundle/ui/jquery.ui.mouse.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="content/jquery-ui/development-bundle/ui/jquery.ui.slider.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="journal.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;section id="journalEntry"&gt;
                  &lt;div id="base"&gt;
                      &lt;label for="intensity"&gt;How intense was it?&lt;/label&gt;  &lt;input type="text" id="intensity" /&gt;&lt;div id="intensityGuage"&gt;&lt;/div&gt; 
                  &lt;/div&gt;
          &lt;/section&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>jQuery Part:</p>
  
  <pre><code>$(document).ready(function(){
          guageBar(intensityGuage,intensity);
  });
  
  function guageBar(guageId,inputId){
          $( "[id='"+guageId+"']" ).slider({
              value:1,
              min: 1,
              max: 10,
              step: 1,
              slide: function( event, ui ) {
                  $( "id[='"+inputId+"']" ).val( ui.value );
              }
          });
          $( "id=['"+inputId+"']" ).val( $( "id=['"+guageId+"']" ).slider( "value" ) );
  }
  </code></pre>
  
  <p>Thanks in advance for your help :)</p>