0

I am using following code to blink a textbox value, but it is not supported by Firefox, IE. How can i achieve? May i do with fade to function.. If yes means help me.

<script>
$(document).ready(function(){

$("#blinkchk").click(function(){
var a=$("#text").val();
a.blink();
});

});
</script>

<body>
<textarea id="text"></textarea>
<input type="checkbox" name="check" id="blinkchk" value="Blink" />Blink
</body>
krishna
  • 4,069
  • 2
  • 29
  • 56
jerome
  • 31
  • 6

5 Answers5

1

Try this. exactly what you want

$("#blinkchk").click(function(){

    setInterval(function() { 
       $("#text").removeClass().addClass("m1")
    }, 400);

       setInterval(function() { 
       $("#text").removeClass().addClass("m2")
    }, 800);
});

DEMO

Sudharsan S
  • 15,336
  • 3
  • 31
  • 49
1

first give the css, transition: color 0.3s;

and then:

$("#blinkchk").click(function(){
    setInterval(function(){
        $('#text').css('color','transparent');
        setTimeout(function(){
            $('#text').css('color','black');
        },500);
    },1000);
});

http://jsfiddle.net/8ebF6/

Amin Jafari
  • 7,157
  • 2
  • 18
  • 43
0

Do something like this for compatibility:

<style>
.blink_on {
opacity: 1;
}
.blink_off {
opacity: 0;
}
</style>

<script>
$(document).ready(function(){
$("#blinkchk").click(function(){
setInterval(function() {
if($("#text").hasClass('blink_on')) {
$("#text").removeClass('blink_on');
$("#text").addClass('blink_off');
}
else {
$("#text").addClass('blink_on');
}
},300);
});

});
</script>

<body>
<textarea id="text"></textarea>
<input type="checkbox" name="check" id="blinkchk" value="Blink" />Blink
</body>
mehulmpt
  • 15,861
  • 12
  • 48
  • 88
0

There's a plugin for jQuery which brings back blink functionality if you're keen on hurting peoples eyes! It allows you to simply use the following to get something to blink:

$('.blink').blink();

http://www.antiyes.com/jquery-blink-plugin

edcs
  • 3,847
  • 2
  • 33
  • 56
0

Use this :

$("#blinkchk").click(function(){
    setInterval(function(){$("#text").fadeOut(200,function(){
      $(this).fadeIn(200);
    })},400);

});

Demo

Bhushan Kawadkar
  • 28,279
  • 5
  • 35
  • 57