SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2002
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    lock input after filled in

    I am using javascript to change quantity at the top of the page. I want it to reflect the same quantity on the bottom of the page, but not be changeable by the user. The user changes quantity, it calculates price, and quantity 2 reflects the change. Quantity 2 should not be changeable.

    using this to put the code in the 2nd field:
    Code:
    document.getElementById("quantity2").value =
        document.getElementById("quantity").value;
    Thanks, I am a beginner with Javascript, ad any help is appreciated.

  2. #2
    secure webapps for all Aleksejs's Avatar
    Join Date
    Apr 2008
    Location
    Riga, Latvia
    Posts
    755
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi!
    In HTML just write:
    <input name="quantity2" id="quantity2" readonly>

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    And when using properly supported attribute names:

    <input name="quantity2" id="quantity2" readonly="readonly">
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •