This code works just fine in Chrome & Firefox - but fails in IE & Safari.
<script type="text/javascript">
$(document).ready(function() {
alert('1');
<?php foreach($options as $option): ?>
<?php if($option['option_choice'] == 1): ?>
var choiceid = <?php echo $option['product_option_id']; ?>;
<?php foreach ($option['option_value'] as $option_value): ?>
<?php if($option_value['whatsize'] == 2): ?>
var choicebigid = <?php echo $option_value['product_option_value_id']; ?>;
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
alert('2');
$('#'+choiceid+''+2).hide();
});
</script>
Alert 1 +2 shows in Chrome/FF, but only Alert 1 shows in IE.
---Generated Chrome JS---
<script type="text/javascript">
$(document).ready(function() {
alert('1');
var choiceid = '321'; //Produktvalg ID
var choicebigid = '1111';
$('#'+choiceid+''+2).hide();
document.getElementById(choiceid+''+2).style.display = 'none';
alert(choiceid);
});
</script>
---Generated IE JS---
<script type="text/javascript">
$(document).ready(function() {
alert('1');
var choiceid = '321'; //Produktvalg ID
var choicebigid = '1111';
$('#'+choiceid+''+2).hide();
document.getElementById(choiceid+''+2).style.display = 'none';
alert(choiceid);
});
</script>
---Update---
Adding single quotes seemed to help generating the IE JS code - before it was empty. This also added the style="display:none;" New problem is that hiding an option is not supported in IE and Safari. Will disable the option along hiding it as well.
---Status--- Fixed. End problem seemed to be hiding and