jeudi 16 juin 2016

Wordpress show and hide dropdown menus

I am really new to coding and well I am using Easydigital downloads FES plugin for WordPress. This plugin has a built in formbuilder.

Every tutorial I see for displaying drop down menus target an ID or a DIV

But this form builders fields has no way of attaching an ID its only the meta name.

I am trying to use the drop-down above selecting "Cinema 4D (.c4d)" option value and showing the field below! Any ideas how this can be done?

$(document).ready(function() {
    $('#software[]').bind('change', function() {
        var elements = $('renderer_used[]').children().hide(); // hide all the elements
        var value = $(this).val();

        if (value.length) { // if somethings' selected
            elements.filter('.' + value).show(); // show the ones we want
        }
    }).trigger('change');
});
<script src="http://code.jquery.com/jquery-1.6.2.js" type="text/javascript"></script>
<select name="software[]" data-required="1" data-type="select" class="__web-inspector-hide-shortcut__">
  <option value="">- select -</option>
  <option value="3D Studio (.3ds)">3D Studio (.3ds)</option>
  <option value="Cinema 4D (.c4d)">Cinema 4D (.c4d)</option>
</select>

Select with the above drop down menu choose opstion "Cinema 4D (.c4d)" to show the dropmenu below

<select name="renderer_used[]" data-required="1" data-type="select">
  <option value="">- select -</option>
  <option value="Default Scanline" selected="selected">Default Scanline</option>
  <option value="Mental Ray">Mental Ray</option>
  <option value="Maxwell ">Maxwell </option>
  <option value="V-Ray ">V-Ray </option>
  <option value="Advanced Renderer">Advanced Renderer</option>
  <option value="Thea ">Thea </option>
  <option value="Octane ">Octane </option>
  <option value="Corona">Corona</option>
</select>

Aucun commentaire:

Enregistrer un commentaire