if ($(e.target).attr('id') != 'tabDiv'  && $(e.target).parents('div#tabDiv').length == 0 && serviceContainer.has(e.target).length === 0){
                $('#tabDiv').parent().parent().find("input[id$='_serviceName']").css('display', '')

I am getting the Uncaught TypeError: $(...).attr is not a function error. and visualforce page is not working properly. we have changed the Jquery library version from 2.2.4 to 3.4.1 currently. is this change causing the issue?

2 Answers 2


I think when changing from version 2 to 3, jquery has implemented closure and strict in library.

Try putting below line in first line of script:

var $ = jQuery.noConflict();

it worked. the error was in j$(window).load(function() {});. changed the code to

j$(window).on("load", function() {});

according to the new jquery version library.

also added jQuery.noConflict(); method and it worked fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .