How do I make this value="11111"
numeric portion conditional on all integers?
if($dd.find('option [value="11111"]US>').length)
Full Code
<script type="text/javascript">
$(function(){
$(".accordionbox dt").filter(function(i,e){
return isActive($(e).next());
}).each(function(i,e){
return toggle($(e));
});
$(".accordionbox dt").on("click", function(){
toggle($(this));
});
});
function toggle($dt){
$dt.next().slideToggle(100); // slide speed 0.1 second
//
if($dt.children(".accordion_icon").hasClass('active')}{
//
$dt.children(".accordion_icon").removeClass('active');
} else{
//
$dt.children(".accordion_icon").addClass('active');
};
};
//
function isActive($dd){
if($dd.find('input[value="email"]:checked').length)
return true;
if($dd.find('option [value="11111"]US>').length)
return true;
return false;
}
;
</script>
I don't think it's possible with just a selector.You should limit the selector to 'option'
and narrow it down to filter()
.
if($dd.find('option') .filter(function() {return/^[0-9]+$/.test(this.value);}).length)
© 2024 OneMinuteCode. All rights reserved.