Reputation: 69
I have downloaded latest version of jquery and added file to web resources. I have added this resource to the library of the form where I intended to use jquery, but when I tried to use simple function it didn't work. JQuery is on top of the library list.
I tried different approach with customizing quote form by adding web resource to a form with the following code:
<html>
<head><meta charset="utf-8"></head>
<body>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<form>
<input type="file">
</form>
<script>
$(":file").change(function()
{
alert($(":file").val());
});
</script>
</body>
</html>
When I try to run this code in CRM I get this message "Error: '$' is undefined". If I save this code to i.e. index.html it works. I was following instructions from the links bellow but without success.
http://crmconsultancy.wordpress.com/2011/06/13/using-jquery-in-crm-2011/ http://thecrmworld.wordpress.com/2011/05/15/how-to-add-jquery-support-to-crm-2011/
Upvotes: 0
Views: 3131
Reputation: 35
If you want to use jQuery you don't have to import the library. If you use parent.$ you are going to use the jQuery library of Dynamics CRM.
If you want to try the Javascript before uploading to a web resource follow this link https://dynamicscrm365helper.blogspot.com/2018/07/how-to-try-crm-javascript-before.html You only have to change the Xrm.Page.getAttribute()...with
parent.$('input#file').on('change',function() {
parent.$('input#file').val()
})
Upvotes: 0
Reputation: 548
Don’t use external links as they are not reliable. This post explains exactly how to bind jquery into your web resource. how do you add jquery in a html page as a web resource in dynamics crm 2011
Upvotes: 2