• 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Print Text Area

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to print a text area using JQuery. Here is my code, I am new to JQuery, any insight on what and how to code could really help. Thanks for your time.
Luke.



Since I am not able to attach the file(don't know why, may be security reasons) I am copy pasting the script file:

jquery.printElement.js






 
Sheriff
Posts: 67528
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
What's the problem? Is that a plugin you found somewhere?
 
Luke Zechariah
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply Bear. My problem is I am not able to print, it is giving me javaScript errors. Not able to print. Is there any other way using jQuery how I could print a text area from a html page. The code I pasted was a script file I found online, may be I did not know how to use it.
 
Bear Bibeault
Sheriff
Posts: 67528
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
That's way too much script for someone to analyze for you. I suspect it would be best to either need to narrow the problem down and ask more specific questions, or contact the author of the script for help.
 
Luke Zechariah
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Bear, lets leave the script code. Overall, do you have any suggestions if I have to print just the text area using Jquery?
 
Bear Bibeault
Sheriff
Posts: 67528
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
Depends how fancy you want to get. Seems pretty easy to do the basic thing:
  • Grab the content of a text area.
  • Create a hidden iframe.
  • Write the content to the iframe, along with a script tag that calls window.print()

  •  
    Luke Zechariah
    Ranch Hand
    Posts: 146
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Thanks Bear, I was able to solve this with the following code, it is working fine if I have normal javaScript but I am missing something with JQuery. Please help. Thanks, Lz.



    JQuery Script Code:
     
    Bear Bibeault
    Sheriff
    Posts: 67528
    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
    This line:is not the way to deal with a jQuery wrapped set.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic