• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Print Text Area

 
Ranch Hand
Posts: 146
  • 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






 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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: 146
  • 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
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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: 146
  • 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
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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: 146
    • 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
    Marshal
    Posts: 67447
    173
    Mac Mac OS X IntelliJ IDE jQuery Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This line:is not the way to deal with a jQuery wrapped set.
     
    Forget Steve. Look at this tiny ad:
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
      Bookmark Topic Watch Topic
    • New Topic