title: jquery flip between val() or text() based on if the page is editable
body: <p>I am trying to figure out if there is already a function to do the following or how would I write a new one
  if the page is editable, i build a table with text boxes in it. </p>
  
  <pre><code>&lt;td&gt;&lt;input type="text" id="blah" ... &gt; &lt;/td&gt;
  </code></pre>
  
  <p>otherwide:</p>
  
  <pre><code>&lt;td id="blah"&gt;Sometext&lt;/td&gt;
  </code></pre>
  
  <p>and then I build another table based on values from this table. </p>
  
  <p>To get the value of the input box in jquery
  i do:</p>
  
  <pre><code>$('#blah').val()
  </code></pre>
  
  <p>otherwise</p>
  
  <pre><code>$('#blah').text()
  </code></pre>
  
  <p>I want to write a function that based on the flag (isEditable) return the elements .val or .text
  for example</p>
  
  <pre><code>jquery.fn.getValue = function() {
      if (isEditable){
          return $(this).val()
      }
      else {
          return $(this).text()
      }
   }
  </code></pre>
  
  <p>and then I would be able to do:</p>
  
  <pre><code>$('#blah').getValue()
  </code></pre>
  
  <p>and I wouldn't care whether its a cell or input box</p>