Using the jQuery $ prefix with TypeScript -
i'm trying cast html input control htmlinputelement in typescript. trying access input control through normal shorthand jquery method,
e.g. <htmlinputelement> $("#comparetocontrol") results in squiggly red line error "neither type jquery nor type htmlinputelement assignable each other.
is there way of getting work, or forced use old longhand way of referencing controls e.g.
<htmlinputelement> document.getelementbyid("comparetocontrol");
that because $(expn) not return dom element instead returns jquery object , not assignable each other. need dom element jquery object of type htmlinputelement. i.e
<htmlinputelement> $("#comparetocontrol")[0] the typing declaration $(expn) using follows. ($ of type jquerystatic)
interface jquerystatic { /** * accepts string containing css selector used match set of elements. * * @param selector string containing selector expression * @param context dom element, document, or jquery use context */ (selector: string, context?: jquery): jquery; }
Comments
Post a Comment