0

If I click on the map, I copy all classes from class li class="salony" id="wojewodztwo-malopolskie" into class <div id="spisSalonow">. It's works correctly.

How can I do that, when I choice krakow from select(selector),Should I copy all classes with name krakow <div class="krakow"> into class <div id="spisSalonow">?

$( document ).ready(function() {  
    $("svg").delegate("*", "click", function(e) { 
        $('.st0').removeAttr('style');
        var id = $(this).attr('id');
        $(this).css("fill", "#ff6600");
            //$('#spisSalonow').stop().slideDown("slow").css('opacity', '0').html($('#wojewodztwo-' + id).html()).animate({opacity: 1}, 1000).slideDown(500);
            $('#spisSalonow').stop().slideDown("slow").css('opacity', '0').html($('#wojewodztwo-malopolskie').html()).animate({opacity: 1}, 1000).slideDown(500);
    });

    $("select" ).change(function() {

        var allListElements = $(".krakow");
        $( "#spisSalonow > div" ).find( allListElements );
       var liczbaSalonow = jQuery('.' +$(this).val()).length;
       //alert(jQuery('.' +$(this).val()).length);


        $('#spisSalonow').stop().slideDown("slow").css('opacity', '0').html($('.' + $(this).val()).html()).animate({opacity: 1}, 1000).slideDown(500);
        alert( $(this).val() );
    });
});

JSFiddle

Ram
  • 3,092
  • 10
  • 40
  • 56
Jurgen
  • 11
  • 2
  • It's apparent you don't speak English native, but your question is unclear. Are you wanting to use the dropdown to add that class to all of the regions? – Leeish Jun 19 '15 at 14:15
  • I reworded the question to improve it as its unclear now. Please make sure the question is right and make title more specific. – Ram Jun 22 '15 at 02:21

1 Answers1

0

https://jsfiddle.net/4q8ud1pw/7/

Is this what you wanted?

Thanks to (jQuery get html of container including the container itself) for showing me how to include the container.

$("select" ).change(function() {
    var html = '';
    $(".krakow").each(function(){
        html += $(this).wrap('<p/>').parent().html();
    });        
    $('#spisSalonow').stop().slideDown("slow").css('opacity', '0').html(html).animate({opacity: 1}, 1000).slideDown(500);
});
Community
  • 1
  • 1
Leeish
  • 5,203
  • 2
  • 17
  • 45