I am using jquery mobile 1.4.2 and script 1.11.0
I have read previously asked questions about this but i didn't get how to use in my code.
This is my code
script
jQuery("input[name^='cat']").bind(jQuery.browser.msie ? 'click' : 'change', function(event) {
var id = jQuery(this).attr('id');
mantener_seleccion(id);//its a function name
});
if i run this its showing error like this "TypeError: jQuery.browser is undefined" Please any one help me in this.
I am using jquery mobile 1.4.2 and script 1.11.0
I have read previously asked questions about this but i didn't get how to use in my code.
This is my code
script
jQuery("input[name^='cat']").bind(jQuery.browser.msie ? 'click' : 'change', function(event) {
var id = jQuery(this).attr('id');
mantener_seleccion(id);//its a function name
});
if i run this its showing error like this "TypeError: jQuery.browser is undefined" Please any one help me in this.
Share Improve this question asked Jun 24, 2014 at 5:51 user3350169user3350169 2091 gold badge4 silver badges14 bronze badges 3- 5 jQuery.browser is deprecated. This property was removed in jQuery 1.9 – Shaunak D Commented Jun 24, 2014 at 5:52
- Is their any solution to replace this code with some other code – user3350169 Commented Jun 24, 2014 at 6:00
- Possible duplicate of jQuery.browser: Javascript Uncaught TypeError – Michał Perłakowski Commented Jan 20, 2016 at 9:59
3 Answers
Reset to default 8Simply add following script in your code.work for me.
<script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script>
Please Refer this link for more info. https://github.com/Studio-42/elFinder/issues/469
jQuery.browser is deprecated. This property was removed in jQuery 1.9
Demo
Use navigation.userAgent
if(navigator.userAgent.toUpperCase().indexOf('MSIE') >= 0){
alert("IE")
}
Use this snippet:
var isIE = navigator.userAgent.toUpperCase().indexOf('MSIE') >=0 ? 'click' : 'change' ;
jQuery("input[name^='cat']").bind(isIE , function(event) {
var id = jQuery(this).attr('id');
mantener_seleccion(id);//its a function name
});
Ankur Modi's answer works, but I'm going to add one for the use case where you're working over a secure connection.
Browsers will filter out mixed content over secure connections, so you'll need to import the JS migrate 1.0.0 manually and install it. In my use-case we're using ASP.Net MVC 5x with a mishmash of older JS widgets.
- Install JS migrate with the NuGet package manager. I installed 1.0.0, as that solved my problem. Newer versions didn't solve my specific problem.
In BundleConfig.cs add the line:
bundles.Add(new ScriptBundle("~/bundles/jqmigrate").Include( "~/Scripts/jquery-migrate-1.0.0.js"));
In _Layout.cshtml add the following line to the bottom of the 'Scripts.Render' section:
@Scripts.Render("~/bundles/jqmigrate")
You should now no longer receive the error.