TYPESCRIPT - Update css of iframe by jquery
Jump to navigation
Jump to search
In your .ts file:
<syntaxhighlight lang="javascript">
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); } }
</syntaxhighligh>