• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Print Text Area

 
Luke Zechariah
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • 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






 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the problem? Is that a plugin you found somewhere?
 
Luke Zechariah
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 128
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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: 128
    • Mark post as helpful
    • send pies
    • 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
    Author and ninkuma
    Marshal
    Pie
    Posts: 65123
    91
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This line:is not the way to deal with a jQuery wrapped set.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic