C.curCSS is not an error function from jQuery

I get this error message in the console.

c.curCSS is not a function ...,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m... 

This function that performs autocompletion:

 function autocomplete_name (name_val, id_val,action, button) { $(document).ready(function () { $(name_val).autocomplete({ source: function( request, response ) { $.ajax({ url: action, dataType: "json", data: { term: request.term }, success: function( data ) { response( $.map( data, function( item ) { return { label: item.name, value: item.name, id: item.id } })); } }); }, minLength: 2, select: function( event, ui ) { $(id_val).val(ui.item.id); $(name_val).val(ui.item.value); $(button).trigger("click") } }); }); } 

I have jQuery version 1.8.3 and I do not have access to the file. This is from another server, I just use the link to the library. The function works, but css is not applied to the results, and I get this error message in the console. YES. I saw the solutions that I need to change in the library, but I do not have access to this. What should I do to make this work.

+6
source share
1 answer

As a workaround, you can simply override $.curCSS() in your module.

After turning on jQuery, write something like:

 jQuery.curCSS = function(element, prop, val) { return jQuery(element).css(prop, val); }; 

jQuery UI will eventually call this function, and the autocomplete widget will work as intended.

Update: I just realized that my answer is a quasi-duplicate of Johann Chavez Sabori's answer there . I will stay here because my function passes the return value of $.css() caller, but it is not.

+29
source

Source: https://habr.com/ru/post/984314/


All Articles