title: .prop() VS .val() .Setting an input text value with jQuery
body: <p>After reading (the interesting) <a href="https://stackoverflow.com/questions/5874652/prop-vs-attr/6057122">.prop() vs .attr()</a> and <a href="http://matthewroach.me/jquery-performance-attributes/" rel="nofollow noreferrer">jQuery Performance : attributes</a> doubt arise in my mind about what is better to use: .prop() or .val() ? I want to set an input text value.</p>
  
  <p>The <a href="http://api.jquery.com/prop/" rel="nofollow noreferrer">jQuery .prop() page</a> said the following: </p>
  
  <blockquote>
    <p>Properties generally affect the dynamic state of a DOM element without changing the serialized HTML attribute. Examples include the value property of input elements, the disabled property of inputs and buttons, or the checked property of a checkbox. The .prop() method should be used to set disabled and checked instead of the .attr() method. <strong>The .val() method should be used for getting and setting value</strong>.</p>
  </blockquote>
  
  <p>But regarding to <a href="http://jsperf.com/setting-input-value" rel="nofollow noreferrer">performance .prop()</a> seems to be better than .val() setting values:
  <img src="https://i.stack.imgur.com/lVnjZ.png" alt=".prop() vs .attr() vs .val()"></p>
  
  <p>So I don't have an answer. 
  What I should do?</p>
  
  <pre><code>$('#element').prop('value', 'Example');
  </code></pre>
  
  <p>or</p>
  
  <pre><code>$('#element').val('Example');
  </code></pre>
  
  <p><strong>EDIT1:</strong>
  .prop() is always better than .val()
  <img src="https://i.stack.imgur.com/PXhRD.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/hpn3P.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/1q7x4.png" alt="enter image description here"></p>
  
  <p><strong>EDIT2:</strong>
  I've tried now <a href="http://jsperf.com/getting-input-text-values" rel="nofollow noreferrer">getting a value</a>, also .prop() is faster
  <img src="https://i.stack.imgur.com/m8U0y.png" alt="enter image description here"></p>
  
  <p><strong>EDIT3:</strong>
  As @BeatAlex says if we want performace native js is <a href="http://jsperf.com/getting-input-text-values" rel="nofollow noreferrer">extremely faster</a></p>
  
  <pre><code>var x = document.getElementById('element').value;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/NhgQx.png" alt="enter image description here"></p>
  
  <p>As some of you said it may be faster, but if .val() exist we'd use it.</p>
  
  <p><em>PS: while I am writing this, current jQuery version is 1.11 or 2.1</em></p>