Check if Javascript function exists or is defined |
X

Congrats, You are Subscribed to Receive Updates.

Check if Javascript function exists or is defined


Check if Javascript function exists or is defined . On certain situations, we have to check the function whether it has definition or exist to call.  Else we have to bear some errors and it will affect next programs, than, total Javascript results failed to run. Its quite  good idea to check whether a function exist or not, which will prevent problems of js errors on function call.   Let me give you the simple code to check it .

if (typeof my_custom_function_kvcodes == 'function') { my_custom_function_kvcodes(); }

here, the custom function may be defined on a separate or another file.

function my_custom_function_kvcodes() {

// Here your custom codes ...

}

thats’ it.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, PHP and Data Analyst. Database Management Advance Level

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar