• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

show contents of a variable in a text area

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the code that I created to try to take the contents of a variable created when the user inputs a part number into the prompt box and by using another button the contents would show up in a textarea.
ultimately I would like to concatenate several variables I nto one and have that variables contents show up in the text area.
The problem is that the name of the variable rather than it's contents is the only thing that shows up in the textarea.
How do I make this work the way I want it too please? thank You.

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

You load jQuery into your page and then don't use it. To load up a text area with jQuery:

$('#txtDescrepancy').val(partnumber);

Some advice on coding:
  • Variable names are important, use whole words and spell then properly: textDiscrepancy
  • Use camel case consistently: partNumber
  • Use jQuery: getElementById, createTextNode, and appendChild are low level methods that should not be used when using jQuery (though it's not a bad idea to understand what they do)
  • Learn and use conventional indentation to make your code easier for others to read.
  •  
    Bear Bibeault
    Sheriff
    Posts: 67746
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Once you've got all that under your belt, we can talk about some important concepts like Separation of Concerns and Unobtrusive JavaScript.
     
    Pat Scarboro
    Greenhorn
    Posts: 2
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thank you very much. A couple of months ago I din't even know what an html was. I'm learning via tutorials on the web. I'm sure I'll be asking more questions. Again. Thanks.
     
    Bear Bibeault
    Sheriff
    Posts: 67746
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    You're welcome. Hopefully all that helps. And don't be shy about asking questions. Learning good habits and practices at the outset will put you ahead of the game. Unlearning ingrained bad practices and habits is one of the more difficult aspects of programming.
    reply
      Bookmark Topic Watch Topic
    • New Topic