javascript - TimeSpinner Check If Undefined Not Working -
I currently have an input text field that can be tied to a particular element of timepinner or, in some cases, Time-Painter's functionality needs to be removed completely (to oppose it inactive), to display it properly on the page
Currently, I have a code to check if the timepinner element exists on or below:
if ($ ("# Elementoff interrects"). Timepinner! == undefined) {$ ("# element of interrex"). Timepinner ("destroyed"); }
This is the first time the page is first loaded , however, it throws the following exception:
Can not call methods before starting on timers; For any reason, passes through the check for
undefined
and tries to timepinner on the element which is not in existence.So the only way my UI is running right this time is to wrap this
try / catch block like this:
If ($ ("# ElementOfInterest"). Timespinner! == Undefined) {try {$ ("# ElementOfInterest"). Timepinner ("destroyed"); } Catch (error) {}} This works, but this place is loose. I will have this check successful and code
try / catch
block Will remove.Am I missing some special checks or something? What's going on here?
Update
I have suggested the following code by @GreenSwift:
if (typeof $ ("# elementoff Interex ") spinner (" example ")! == 'undefined') {$ (" # element of interrects ") Timepinner ("destroyed"); }
However, I have been given this exception:
Can not call ways on spinner before starting; Attempted to call method 'example'
I also tried to type
titlepinner ("Example"), but I got back:
There is no undefined method
It seems that checking a example of a timepinner was not implemented.
Good
$ ("# ElementOfInterest"). Timespinner! == Undefined
simply checks if$ (). Timespinner is defined, which will be until the plugin loads. Checking about whether the element has the class which adds the spinner.
if ($ ("# ElementOfInterest"). Hcl ('ui-spinner-input'))
Comments
Post a Comment