jQWidgets Forums

This topic contains 1 reply, has 2 voices, and was last updated by  Vladimir 9 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Identify object type #75667

    nimli
    Participant

    Hello,

    I am trying to write a generic function to update some values in the input fields.

    In the generic function, I have something like:

    function test(field_name){
       ...
       if ($('#' + field_name + '.jqx-input').length == 1) {
           // update the value in the input field
       }
       else if (...)
       ..
    }
    

    The purpose of the “if statement” is to confirm the type the field is a “jqxinput” field. If it is something else, I may need to a different update statement to update the field.

    I wonder if there is a better way to identify the type, which can be used generically for “jqxinput” field, as well as other “jqwidgets” objects as well.

    Thank you.

    Identify object type #75683

    Vladimir
    Participant

    Hello nimli,

    Unfortunately there is no direct way to check what type of widget an element is.
    If you need to remember what widget is assigned to what element you would need to store this information yourself. I.e. hold it in array for example.

    However if you only need to set/get the value of the field, you can try using the .val() method which is supported by a big part of the widgets so depending on your case it may work for you.

    Best Regards,
    Vladimir

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.