Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

click through span

Tags:

jquery

I have a span tag that's over an input field. What I'm trying to do is when you click on the input field the span with text in it gets hidden. then on Blur it's shown. This all works using jquery. The problem is because the span is on top of the input field the input focus doesn't get triggered when you click on the span text. Is there a way to get around this and not have the span stop the input filed focus from working.

like image 696
Chapsterj Avatar asked Sep 13 '26 13:09

Chapsterj


1 Answers

You could set the focus on the input if the span is clicked.

$('#span').click(function() {

     $('#input').focus();

});

$('#input').focus(function() {

     $('#span').hide();

});

$('#input').blur(function() {

     $('#span').show();

});
like image 188
Jeffrey Avatar answered Sep 16 '26 02:09

Jeffrey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!