Difference between revisions of "TYPESCRIPT - Update css of iframe by jquery"
Jump to navigation
Jump to search
(Created page with "In your .ts file: <syntaxhighlight lang="javascript"> private mainFunction(): void { this.waitForEl('#iframeABC', '.comment', 0, () => { $('#iframeABC').c...") |
|||
Line 29: | Line 29: | ||
</ | </syntaxhighlight> |
Revision as of 14:34, 20 April 2018
In your .ts file:
private mainFunction(): void {
this.waitForEl('#iframeABC', '.comment', 0, () => {
$('#iframeABC').contents().find('.comment').css({
'border-left': '0px',
'border-right': '0px'
});
console.log('Updated css iframe');
});
}
private waitForEl(iframe: string, selector: string, count: number, callback: () => void): void {
if (PaylineUtils.jQuery(iframe).contents().find(selector).length > 0) {
callback();
} else {
setTimeout(() => {
count++;
if (count <= 10) {
this.waitForEl(iframe, selector, count, callback);
} else {
return;
}
}, 1000);
}
}