0
    <script>
$(document).ready(function(){
 var currentsize = $('option:selected', $('select#size')).val();
    $.ajax({
        type: \"post\",
        url: \"tshirt_ajax.php?checkshop=$shopid&checkproducttype=$producttype&stockcolor=\" + $('#productColor$articleid').val() + \"&currentsize=\" + currentsize,
        success: function(data){
            $('select#size').html(data);
   $('#size').coreUISelect();
   $('#quantity').coreUISelect();
  }
    });

   $('a.colorlink').click(function(e){
 e.preventDefault();
    var stockcolor = $(this).attr('id'),
        checkshop = $shopid,
        checkproducttype = $producttype;

    $.ajax({
        type: \"post\",
        url: \"tshirt_ajax.php?checkshop=\" + checkshop + \"&checkproducttype=\" + checkproducttype + \"&stockcolor=\" + stockcolor + \"&currentsize=\" + currentsize,
        beforeSend: function(){
            $('#productColor$articleid').val(stockcolor);
        },
        success: function(data){
            $('select#size').html(data);
        $('#tshirtimg').attr('src', '$http://www.ni-dieu-ni-maitre.com/images/".$productid."_' + stockcolor + '_2/t-shirt-couleur.png');
        $('#ex1 .zoomImg').attr('src', '$http://www.ni-dieu-ni-maitre.com/images/".$productid."_' + stockcolor + '_2/t-shirt-couleur.png');
   $('#size').coreUISelect('update');
        }
    });

    });

 $('select#size').change(function(){
  currentsize = $('option:selected', this).val();
 });

});
</script>

I also have the following div:

<div class='etiquettedescription_content' style='display:none;'>

On the script above, i want to add the following commands:

I'm trying to modify the script above so when "a.colorlink" is clicked, i want to unhide the div but only IF the clicked stockcolor corresponds to 1, 351, 63 OR 16

Any idea how i can do that ?

2 Answers 2

1

if i understand your question correctly, then try this:

$('a.colorlink').click(function(e){
 e.preventDefault();
    var stockcolor = $(this).attr('id'),
        checkshop = $shopid,
        checkproducttype = $producttype;
        if( stockcolor==="1" || stockcolor==="351" stockcolor==="63" stockcolor==="16"  ){
            $(".etiquettedescription_content").show();
        }else{
            $(".etiquettedescription_content").hide();
        }
        .....
Sign up to request clarification or add additional context in comments.

Comments

1

If I misunderstand your question, sorry.

In $('a.colorlink').click event handler, add

if(stockcolor == 1 || ... other values) {
    $('.etiquettedescription_content').css('display', 'block');
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.