Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use the 'value' attribute to set the value of a text input field</p> <pre><code>&lt;td&gt;&lt;input id="Name" name="Name" type="text" value="@Minus(products.ReorderLevel, products.StockLevel)" /&gt; &lt;/td&gt; </code></pre> <p>For changing the values you're gonna have to write some JavaScript. Look into <a href="http://jquery.com/" rel="nofollow">jquery</a> for a simple way to look up and manipulate DOM-objects such as your textbox (the <code>$("..")</code>-stuff in the example below </p> <pre><code>&lt;script type="text/JavaScript" src="/path/to/your/jquery.version.js"&gt;&lt;/script&gt; &lt;script type="text/JavaScript"&gt; // Declare a function to increment a value var incrementField = function() { var newValue = 1 + parseInt($("#name").val()); $("#name").val(newValue); }; // Declare a function to decrement the value var decrementField = function() { var newValue = parseInt($("#name").val()) - 1; $("#name").val(newValue); }; &lt;/script&gt; </code></pre> <p>and call it from your html:</p> <pre><code>&lt;button onclick="incrementField()"&gt;+&lt;/button&gt; &lt;button onclick="decrementField()"&gt;-&lt;/button&gt; </code></pre> <p>This is very basic, untested and prototype quality stuff. A different approach is to use <a href="http://api.jquery.com/click/" rel="nofollow">jQuery .click()</a> to hook up your increase/decrease logic. </p> <p><strong>Update: Working jsFiddle example here:</strong> <a href="http://jsfiddle.net/Am8Lp/2/" rel="nofollow">http://jsfiddle.net/Am8Lp/2/</a></p> <p>Set an ID to your buttons and use the following javascript:</p> <pre><code> // This creates a callback which called when the page is fully loaded $(document).ready(function(){ // Set the initial value of the textbox $("#name").val('0'); // Create a click handler for your increment button $("#increaseButton").click(function(){ var newValue = 1 + parseInt($("#name").val()); $("#name").val(newValue); }); // .. and your decrement button $("#decreaseButton").click(function(){ var newValue = parseInt($("#name").val()) - 1; $("#name").val(newValue); }); }); </code></pre> <p>Finally add an ID to your buttons and remove the old click handler</p> <pre><code>&lt;button id="increaseButton"&gt;+&lt;/button&gt; &lt;button id="decreaseButton"&gt;-&lt;/button&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload