cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

call function on object jquery

Hi,

I am struggling to get a jquery scrip working.
I see my custom visual has the right div and structure.
I added the following to get jquery to work in an external js:
var jQuery = typeof jQuery !== 'undefined'
? jQuery
: window['$'];

now I need to call a function something like :
<script type="text/javascript">
$('#mycontainer').myinit();
</script>

I could not find anything similar working in github and I am really struggling I get different kind of errors based on how/where I try to call this.

any tip please let me know

thanks

 

5 REPLIES 5
Highlighted
Community Champion
Community Champion

Re: call function on object jquery

Hi @Js29,

 

jQuery works fine in most of cases.

What errors did you get? Can you share the source code for deeper understanding?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

 

Highlighted
Frequent Visitor

Re: call function on object jquery

Thanks, sent you link in private message.

 

high level for everybody. as a test, I have the following in an external js which I expect to kick off once document is ready

 

(function($) {
  console.log( "ready call flip!" );
  $("#card").flip();
}(jQuery));

and my constructor just has 

 

this.host = options.host;
let cont=$('<div/>')
.addClass('ca-container').attr('id','card');
let c1= $('<div/>');
c1.addClass('front');
    c1.html(' TOTOTOTOTOTOTO');
cont.append(c1);
let c2= $('<div/>');
c2.addClass('back');
    c2.html(' _______________________');
cont.append(c2);
this.mycanvas = cont;
Highlighted
Community Champion
Community Champion

Re: call function on object jquery

Did you send source code via email?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Highlighted
Frequent Visitor

Re: call function on object jquery

Hi @v-viig Ignat, I had tried a private message, it seems it had failed, I just retried now.

 

JS

Highlighted
Community Champion
Community Champion

Re: call function on object jquery

Hi JS,

 

Replied to you yesterday. Please check your inbox.

 

Please also consider sharing source code here to share the solution with community.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors