Printing an HTML form using jQuery -


I have an HTML form, and I have to print (hardcopy) the specific area.

The problem is that I am unable to get Text1 and Text2 values ​​on it. Since I need to fill the HTML value with some value, so print it must be printed as hardcopy.

My code
  & lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ("# print"). Click (function () {alert ($ ('# click'). Html ()); // it only shows form element; Should also be a type of typing element. How? Window.print ();});}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form ID = "click" & gt; Text 1: & lt; Input id = "l" type = "text" / & gt; Text 2: & lt; Input id = "m" type = "text" /> & Lt; Input id = "print" type = "button" value = "print-me" /> & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

Which I can understand, you want text that is written in text 1 And Text2 input field you can do this .val () function, such as:

  $ ("# print"). Click (function () (warning ($ ('# l'). Val () + '\ n' + $ ('# m'). Val ()); window. Print ();});    

Comments