Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript" src="http://form.jotform.me/jsform/30295750834457"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
- <script>
- $.noConflict();
- (function($){
- var
- jotform_id = "#30295750834457", //usually jotform id, needed to reference the iframe
- independent_id = '#input_3', //replace by the id of the master/depended on, state
- dependent_id = '#input_4' //replace by the id of the slave/dependent dropdown select, counties
- ;
- $(document).ready(function(){
- //make sure jotform is loaded
- $(jotform_id).load(function() {
- $independent = $(this).contents().find(independent_id);
- $dependent = $(this).contents().find(dependent_id);
- //bind change event
- $independent.change(function(){
- //trim
- var current_state = $independent.val().replace(/^\s+|\s+$/g, '');
- //alert('state dropdown was changed to: ' + current_state);
- //iterate options, check last 2 characters if match
- $dependent.find('option').each(function(){
- if ($(this).val().substr(-2) == current_state)
- $(this).show();
- else
- $(this).hide();
- });
- });
- })
- });
- })(jQuery);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement