praveen
praveen

Reputation: 351

Loading different versions of Jquery files

I have page on which I am using some third party controls. This assembly is loading jQuery version 1.3. But in my application master page I am using jQuery 1.8.3 due to which my page is not working properly. It is showing the below error message.

Microsoft JScript runtime error: Object doesn't support this property or method

Is there any way that I can solve this issue?

Thanks,

Praveen.

Upvotes: 0

Views: 63

Answers (1)

Emil A.
Emil A.

Reputation: 3445

You should try to update the scripts to work with the newer version of jQuery. If that's not possible then you can use the jQuery.noConflict() method to create a safe reference to chosen version.

<script type="text/javascript" src="//code.jquery.com/jquery-1.3.min.js"></script>
<script type="text/javascript">
    var $1_3 = jQuery.noConflict(true);
</script>

<script type="text/javascript" src="//code.jquery.com/jquery-1.8.1.min.js"></script>
<script type="text/javascript">
    var $1_8_1 = jQuery.noConflict(true);
</script>

You should be able to use it in the code:

$1_3.trim("   abc    ");   // "abc";
$1_8_1.trim("   abc    ");   // "abc";

It's not a perfect solution and I would recommend to use one version of jQuery only.

Upvotes: 1

Related Questions