0

I have a html form which is for the printing purpose. The html form have two different style sheet for the web view and print view. I want to add two different JavaScript functions (those function has using to handle the dynamic height for the row in the form but not working in the print view).

How I can add a JS function only for the print view?.

I am using the following code for the print view. But its not working .

@Printing = print : () -> if /TappyNativeApp/.exec(navigator.userAgent) document.location = "toppy:printView:" else if window.print alert("hi") heightvalue = $(".show_seller_box").outerHeight(); $(".buyer_box").outerHeight(heightvalue); window.print() jQuery ($) -> $('.print_btn').click( (event) -> Printing.print() )'
Fazil Abdulkhadar
  • 1,091
  • 5
  • 11
  • More details please with code sample. – Sudipta Kumar Maiti Nov 04 '15 at 04:11
  • Please show all relevant code. Also the question is unclear. Are you saying that the code that adjusts the height is not running in print view? – Ruan Mendes Nov 04 '15 at 04:11
  • I am using the current code for the print view. But its not working . `@Printing = print : () -> if /TappyNativeApp/.exec(navigator.userAgent) document.location = "toppy:printView:" else if window.print alert("hi") heightvalue = $(".show_seller_box").outerHeight(); $(".buyer_box").outerHeight(heightvalue); window.print() jQuery ($) -> $('.print_btn').click( (event) -> Printing.print() )'` – Fazil Abdulkhadar Nov 04 '15 at 04:17
  • hmm something is not right here. – Fiido93 Nov 04 '15 at 04:28
  • Does this link http://stackoverflow.com/questions/7726252/can-you-have-call-javascript-only-when-print-is-called help you? – Rajesh Omanakuttan Nov 04 '15 at 04:34
  • I have tried this. Unfortunately it is not working. If there are any other way ?. – Fazil Abdulkhadar Nov 05 '15 at 04:34

0 Answers0