Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of getPreventDefault() is deprecated. Use defaultPrevented instead

I want to Print receipt page on loading page in firefox

Firefox shows following error..

Use of getPreventDefault() is deprecated. Use defaultPrevented instead. error source line:

src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;

NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMWindow.print] error source line:


print();

code:

$(document).ready(function() {
    print_doc();
    $("#Submit").click(function() {
        $("#goBack").hide();
        $("#printRow").hide();
        print();
        $("#goBack").show();
        $("#printRow").show();
    });
});

function print_doc() {
    $("#goBack").hide();
    $("#printRow").hide();
    print();
    $("#goBack").show();
    $("#printRow").show();
}

I want to print my receipt before showing "goBack", and "printRow" id's but not working

like image 949
Mian Anjum Avatar asked Oct 04 '13 07:10

Mian Anjum


2 Answers

Upgrade both your versions of Firefox & jQuery version from 1.6.4 to a more recent version.

This was filed as a bug in Firefox in FF11 & Patched as a result:

Bug #707677: getPreventDefault(); deprecated

As after all, the error messages refer to lines of source code that are completely unrelated to your code.

like image 167
MackieeE Avatar answered Oct 14 '22 12:10

MackieeE


you can create new css with media type print

<style media="print">
#goBack,#printRow {
   display:none;
}
</style>

used this code

print :

Intended for printed documents (applies to docs viewed in print preview mode too).

CSS Media Type

like image 30
Shakti Patel Avatar answered Oct 14 '22 12:10

Shakti Patel