javascript - Uncaught TypeError: Illegal invocation (chrome) -
i'm trying call function in javascript when user clicks button (onclick="website.submit()"
), code doesn't work.
i getting error in chrome:
uncaught typeerror: illegal invocation
in chrome, line highligted in jquery.js
source of error:
// if value function, invoke , return value value = jquery.isfunction( value ) ? value() : ( value == null ? "" : value );
more detailed error on developer panel's console tab (f12):
here code:
var website = { submit: function () { var stap1 = $('#stap1').val(); var stap2 = $('#stap2').val(); var stap3 = $('#stap3').val(); var letop = $('#letop').val(); if (stap1.length == 0) { $('#error2').show(); $('#the_error2').html('je moet alle velden invullen om door te gaan.'); $('#stap1').css({ 'border-width': '1px', 'border-color': 'red' }); } if (stap2.length == 0) { $('#error2').show(); $('#the_error2').html('je moet alle velden invullen om door te gaan.'); $('#stap2').css({ 'border-width': '1px', 'border-color': 'red' }); } if (stap3.length == 0) { $('#error2').show(); $('#the_error2').html('je moet alle velden invullen om door te gaan.'); $('#stap3').css({ 'border-width': '1px', 'border-color': 'red' }); } if (letop.length == 0) { $('#error2').show(); $('#the_error2').html('je moet alle velden invullen om door te gaan.'); $('#letop').css({ 'border-width': '1px', 'border-color': 'red' }); } if (stap1.length !== 0 && stap2.length !== 0 && stap3.length !== 0 && letop.length !== 0) { $.post(general.url + "/pages/website_check.php", { naam: naam, subdomein: subdomein, stap1: stap1, stap2: stap2, stap3: stap3, letop: letop }, function (result) { if (result == 1) { $('#error2').show(); $('#the_error2').html('deze naam al in gebruik. ga snel terug en kies een andere.'); $('#error').show(); $('#the_error').html('deze naam al in gebruik. kies een andere.'); $('#naam').css({ 'border-width': '1px', 'border-color': 'red' }); } else { if (result == 2) { $('#error2').show(); $('#the_error2').html('dit subdomein al in gebruik. ga snel terug en kies een andere.'); $('#error').show(); $('#the_error').html('dit subdomein al in gebruik. kies een andere.'); $('#subdomein').css({ 'border-width': '1px', 'border-color': 'red' }); } } }); } } };
just comment line value = jquery.isfunction( value ) ? value() : ( value == null ? "" : value ); in jquery.js.
i.e.
add = function( key, value ) { // if value function, invoke , return value //value = jquery.isfunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeuricomponent( key ) + "=" + encodeuricomponent( value ); };
Comments
Post a Comment