Property ‘style’ does not exist on type ‘element’ property does not exist on type ‘element’
Reason: This is caused by TypeScript type checking, which requires a type assertion in front of the querySelector method.
Reason: This is caused by TypeScript type checking, which requires a type assertion in front of the querySelector method.
let frameContainObj = document.getElementById("model_view_container")
let iframeObj= <HTMLElement>frameContainObj.querySelector("#modelView");
iframeObj.style.height = document.documentElement.clientHeight* 0.65 + "px";
Extensions: When using QuerySelectorAll, the following scenario can be used:
let block = document.querySelectorAll(".block") as NodeListOf<HTMLElement>;
Tells the TypeScript compiler to pass this code by setting assertions
Read More:
- Error: property ‘TZ’ does not exist on type ‘type of moment’
- error TS2339:Property ‘length’ does not exist on type ‘object’
- Vue + element, SCSS plus / deep / style does not work
- Element ‘dependency‘ cannot have character [children], because the type‘s content type is element-on
- Datatable plug-in error: uncaught typeerror: cannot read property ‘style’ of undefined
- JS prompt cannot read property ‘style’ of undefined
- Invalidation of margin top property of nested box in CSS style box
- Refused to apply style from <URL> because its MIME type (‘text/html‘) is not a supported stylesheet
- Failed to execute ‘getComputedStyle’ on ‘Window’: parameter 1 is not of type ‘Element’.
- Error tips:array type has incomplete element type
- array type has an incomplete element type
- (element UI component table) how to add a style to a table
- error CS0234: The type or namespace name ‘UI‘ does not exist in the namespace ‘UnityEngine‘
- Selenium reports an error and solves the problem of element not interactive exception, element not interactive
- Maven compilation error: package does not exist jar package does not exist
- cvc-complex-type.2.3: Element ‘beans’ cannot have character [children]
- SystemError: new style getargs format but argument is not a tuple
- Uncaught type error: cannot read property ‘MSIE’ of undefined
- Property or field ‘Title‘ cannot be found on object of type
- error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not