• Resolved shaon007

    (@shaon007)


    Hi,

    I am having a problem with my select tag. I want something like this with JavaScript or jQuery.

    Currently I have like this..
    <select id=”good”>
    <option>…..</option>
    </select>
    <select id=”good”>
    <option>…..</option>
    </select>

    I want like this…
    <select id=”good” class=”one1″>
    <option>…..</option>
    </select>
    <select id=”good” class=”one2″>
    <option>…..</option>
    </select>

    I want to add different class name where my both Select has same ID

    Can you please provide a javascript or jquery code about it??

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @shaon007

    When you insert a field in the form, the plugin ensures its id is unique, no matter if it is a DropDown field like in your demo, Single Line Text, Calculated field, or any other.

    Please, let me know the way you are inserting the fields in the form.

    Best regards.

    Thread Starter shaon007

    (@shaon007)

    Yes i know that, but the thing is I am using same form in single page. And i want when customer select a value of one form, other form value will be changed according to the first form. I google something like that and i came to know with jQuery I can solve it.
    Can you provide any code like that. Just check my first message. I explain everything.

    Plugin Author codepeople

    (@codepeople)

    Hello @shaon007

    If you assign a class name to the DropDown fields (note the class names are assigned to the fields through their attributes: “Add CSS Layout Keywords”), for example my-field

    You can insert an “HTML Content” field in the form with the following piece of code as its content:

    
    <script>
    jQuery(document).on('change', '.my-field select', function(){
    var e = jQuery(this), v = e.find('option:selected').val();
    jQuery('.my-field select option[value="'+v+'"]').prop('selected', true);
    });
    </script>
    

    Best regards.

    Thread Starter shaon007

    (@shaon007)

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add Class In Select tag’ is closed to new replies.