2

I just want to check a textbox to open Fancybox.
If the textbox is empty then I want Fancybox to work else I just want to redirect another page. how can I do this.

The below code I have my Fancybox whenever I click 'Inline' then the div open.

<a class="fancybox" href="#inline1">Inline</a>  
<div id="inline1" style="width:400px;display: none;">
    <h3>Etiam quis mi eu elit</h3> 
</div>

but I have another button with its textbox and it search something in my web page.

<form action="/Isim/Arama" method="get">    
    <input type="text" id="searchedPart" class="searchedName generalTextArea" name="searchedPart" value=""> 
    <input class="searchNameSearchButton" type="submit" value="">
</form>

now I want the following

if searchedPart is empty
then show fancybox
else
do what it does currently

Radim Köhler
  • 122,561
  • 47
  • 239
  • 335
brtb
  • 2,201
  • 6
  • 34
  • 53

1 Answers1

1

Using javascript can help you to solve this "if searchedPart is empty,then show fancybox else do what it does currently"

$(document).ready(function() {
   $('#searchedPart').keyup(function() {
       if($('#searchedPart').val()) {
         $('.fancybox').css('display','none');
       }
   });
});

Good Luck!

Surekha
  • 73
  • 6