oto kod:
<script> //zmiana naglowka var naglowek = $(".top_3_item_head_val span.grey_12_a").text(); var naglowek = naglowek.length; alert(naglowek); if(naglowek<14){ $(".top_3_item_head_val span.grey_12_a").animate({opacity: 0}, 500, function(){ $(".top_3_item_head_val span.grey_12_a").text('Oprocentowanie'); $(".top_3_item_head_val span.grey_12_a").animate({opacity: 1}, 500); }); } </script>
generalnie alert wyrzuca cyfrę 14, natomiast if się wykonuje - czyli 14 jest mniejsze od 14.
Wcześniej oczywiście kombinowałem na stringu.
<script> //zmiana naglowka var naglowek = $(".top_3_item_head_val span.grey_12_a").text(); alert(naglowek); if(naglowek != "napis"){ $(".top_3_item_head_val span.grey_12_a").animate({opacity: 0}, 500, function(){ $(".top_3_item_head_val span.grey_12_a").text('Oprocentowanie'); $(".top_3_item_head_val span.grey_12_a").animate({opacity: 1}, 500); }); } </script>
Alert wyrzuca to co chciałem, ale if dalej wchodzi.
Co robię źle?