Solved

Help I need help Please

Posted on 2011-09-29
22
219 Views
Last Modified: 2012-05-12
Hi,

this is my site

http://www.churchesbulletin.com/post.cfm?chid=11

I am working on the menu

there is three buttons

Search by State

Search by City

Search by Church

when I click on the "search by state" button

It display the div for the state but then I cannot select a state?

Please, tell me what I am doing wrong.

Thanks,

<script type="text/javascript" src="JS/jquery-latest.min.js"></script> 


<script>
$(document).ready(function() {
	$(".divCollapsablePanel").click(function(){
		$(".divCollapsablePanelDetail").hide();
		//$(".divCollapsablePanelDetail",this).show(1000);
		$(".divCollapsablePanelDetail",this).show(100);

	});
});
</script>


_______________________________________________________

<div class="divCollapsablePanel">
		<div align="center" class="BtnSearchByState" style="text-align:center;padding: 0px 0px 0px 0px;" >							
		<input name="BtnSearchByState" type="button" value="" > 
		</div>
<div class="divCollapsablePanelDetail">
<div>&nbsp;</div>
	Filter State:&nbsp;<input name="txtST" size="13" value="" type="text"/>
	<select name="SelST" size="1" style="width: 100px;"/>
	<option>Michigan </option>
	</select>
</div>
</div>

<div class="divCollapsablePanel">
	   <div align="center" class="BtnSearchByCity" style="text-align:center;padding: 0px 0px 0px 0px;" >							
		<input name="BtnSearchByCity" type="button" value="" > 
		</div>
<div class="divCollapsablePanelDetail">
<div>&nbsp;</div>
	Filter State:&nbsp;<input name="txtSTCT" size="13" value="" type="text"/>
	<select name="SelSTCT" size="1" style="width: 100px;"/>
	<option>Michigan </option>
	</select>
	
<div>&nbsp;</div>
	Filter City:&nbsp;<input name="txtSTST" size="13" value="" type="text"/>
	<select name="SelSTST" size="1" style="width: 100px;"/>
	<option>Sterling heights </option>
	</select>
</div>
</div>

<div class="divCollapsablePanel">
		<div align="center" class="BtnSearchByChurch" style="text-align:center;padding: 0px 0px 0px 0px;" >							
		<input name="BtnSearchByChurch" type="button" value="" > 
		</div>
<div class="divCollapsablePanelDetail">
<div>&nbsp;</div>
	Filter State:&nbsp;<input name="txtChST" size="13" value="" type="text"/>
	<select name="SelChST" size="1" style="width: 100px;"/>
	<option>Michigan </option>
	</select>
	
<div>&nbsp;</div>
	Filter City:&nbsp;<input name="txtChCT" size="13" value="" type="text"/>
	<select name="SelChCT" size="1" style="width: 100px;"/>
	<option>Sterling heights </option>
	</select>
	
<div>&nbsp;</div>
	Filter Church:&nbsp;<input name="txtChCh" size="13" value="" type="text"/>
	<select name="SelChCh" size="1" style="width: 100px;"/>
	<option>St Patricks </option>
	</select>
</div>
</div>

Open in new window

0
Comment
Question by:lulu50
  • 11
  • 8
  • 3
22 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36818719
you've :
      $(".divCollapsablePanel").click(function(){
            $(".divCollapsablePanelDetail").hide();
            //$(".divCollapsablePanelDetail",this).show(1000);
            $(".divCollapsablePanelDetail",this).show(100);
      });

the dropdown is inside the CollapsablePanel
So each time you click on the dropdown your code is executed
You should put divCollapsablePanelDetail outside your divCollapsablePanel
0
 

Author Comment

by:lulu50
ID: 36818731
I made changes just to the state and put the div outside it did not work.
my toggle is not work


      
<div class="divCollapsablePanel">
		<div align="center" class="BtnSearchByState" style="text-align:center;padding: 0px 0px 0px 0px;" >							
		<input name="BtnSearchByState" type="button" value="" > 
		</div>
  </div>
<div class="divCollapsablePanelDetail">
<div>&nbsp;</div>
	Filter State:&nbsp;<input name="txtST" size="13" value="" type="text"/>
	<select name="SelST" size="1" style="width: 100px;"/>
	<option>Michigan </option>
	</select>
</div>

Open in new window

0
 
LVL 4

Expert Comment

by:rar3z
ID: 36818733
Yup, was gonna say the same thing..  You just beat me to it :)
0
 
LVL 4

Expert Comment

by:rar3z
ID: 36818738
Change the name of "divCollapsablePanel" and "divCollapsablePanelDetails" a bit, dont keep the same, when jquery is applying for the panel only it seems to be acting upon detail as well due to it's preceding name. change the name of the divecollapsablepaneldetails to something different.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36818747
replace :
      $(".divCollapsablePanel").click(function(){
            $(".divCollapsablePanelDetail").hide();
            //$(".divCollapsablePanelDetail",this).show(1000);
            $(".divCollapsablePanelDetail",this).show(100);
      });
by :
      $(".divCollapsablePanel").click(function(){
            $(".divCollapsablePanelDetail").hide();
            //$(".divCollapsablePanelDetail",this).show(1000);
            $(this).next(".divCollapsablePanelDetail").show(100);
      });
0
 
LVL 4

Expert Comment

by:rar3z
ID: 36818751
While keeping your old code structure, I've changed the name of "divCollapsablePanelDetails" to "divCollapsablesPanelsDetail" and tried, and I was able to select the state.
0
 

Author Comment

by:lulu50
ID: 36818758
leakim971

I tried this but it didn't work

<script>
$(document).ready(function() {
      $(".divMain").click(function(){
            $(".divSub").hide();
            //$(".divSub",this).show(100);
            $(this).next(".divSub").show(100);

      });
});
</script>
0
 

Author Comment

by:lulu50
ID: 36818760
I changed the names it's not working


<script>
$(document).ready(function() {
	$(".divMain").click(function(){
		$(".divSub").hide();
		//$(".divSub",this).show(100);
		$(this).next(".divSub").show(100);

	});
});
</script>


	<div class="divMain">
		<div align="center" class="BtnSearchByState" style="text-align:center;padding: 0px 0px 0px 0px;" >							
		<input name="BtnSearchByState" type="button" value="" > 
		</div>
	<div class="divSub">
<div>&nbsp;</div>
	Filter State:&nbsp;<input name="txtST" size="13" value="" type="text"/>
	<select name="SelST" size="1" style="width: 100px;"/>
	<option>Michigan </option>
	</select>
</div>	
		
  </div>


<div class="divMain">
	   <div align="center" class="BtnSearchByCity" style="text-align:center;padding: 0px 0px 0px 0px;" >							
		<input name="BtnSearchByCity" type="button" value="" > 
		</div>
<div class="divSub">
<div>&nbsp;</div>
	Filter State:&nbsp;<input name="txtSTCT" size="13" value="" type="text"/>
	<select name="SelSTCT" size="1" style="width: 100px;"/>
	<option>Michigan </option>
	</select>
	
<div>&nbsp;</div>
	Filter City:&nbsp;<input name="txtSTST" size="13" value="" type="text"/>
	<select name="SelSTST" size="1" style="width: 100px;"/>
	<option>Sterling heights </option>
	</select>
</div>
</div>

<div class="divMain">
		<div align="center" class="BtnSearchByChurch" style="text-align:center;padding: 0px 0px 0px 0px;" >							
		<input name="BtnSearchByChurch" type="button" value="" > 
		</div>
<div class="divSub">
<div>&nbsp;</div>
	Filter State:&nbsp;<input name="txtChST" size="13" value="" type="text"/>
	<select name="SelChST" size="1" style="width: 100px;"/>
	<option>Michigan </option>
	</select>
	
<div>&nbsp;</div>
	Filter City:&nbsp;<input name="txtChCT" size="13" value="" type="text"/>
	<select name="SelChCT" size="1" style="width: 100px;"/>
	<option>Sterling heights </option>
	</select>
	
<div>&nbsp;</div>
	Filter Church:&nbsp;<input name="txtChCh" size="13" value="" type="text"/>
	<select name="SelChCh" size="1" style="width: 100px;"/>
	<option>St Patricks </option>
	</select>
</div>
</div>

Open in new window

0
 
LVL 82

Expert Comment

by:leakim971
ID: 36818765
you let divsub inside divmain...
need to be outside like the previous one with the other name

divCollapsablePanel (divmain)
divCollapsablePanelDetail (divsub)
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36818779
if you don't want to put divsub outside divmain, use :
$(document).ready(function() {
      $(".BtnSearchByState").click(function(){
            $(".divSub").hide();
            //$(".divSub",this).show(100);
            $(this).next(".divSub").show(100);

      });
});
0
 

Author Comment

by:lulu50
ID: 36819035
leakim971,

if I have the divsub outside the divmain (it's still not working)
<div class="divMain">
		<div align="center" class="BtnSearchByState" style="text-align:center;padding: 0px 0px 0px 0px;" >							
		<input name="BtnSearchByState" type="button" value="" > 
		</div>	
  </div>
	<div class="divSub">
<div>&nbsp;</div>
	Filter State:&nbsp;<input name="txtST" size="13" value="" type="text"/>
	<select name="SelST" size="1" style="width: 100px;"/>
	<option>Michigan </option>
	</select>
</div>

Open in new window

0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 82

Expert Comment

by:leakim971
ID: 36819051
replace :
$(document).ready(function() {
    $(".BtnSearchByState").click(function(){
        $(".divSub").hide();
        $(".divSub",this).show(100);

    });
});

Open in new window

by :
$(document).ready(function() {
    $(".BtnSearchByState").click(function(){
        $(".divSub").hide();
        $(this).parent().next(".divSub").show();
    });
});

Open in new window

0
 

Author Comment

by:lulu50
ID: 36819075
I did but now it won't toggle and search by city is not working or the church
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36819096
replace :
$(document).ready(function() {
    $(".BtnSearchByState").click(function(){
        $(".divSub").hide();
        $(this).parent().next(".divSub").show();
    });
});
by :
$(document).ready(function() {
    $(".BtnSearchByState,.BtnSearchByCity,.BtnSearchByChurch").click(function(){
        $(".divSub").hide();
        $(".divSub",this).show(100);

    });
});
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36819100
sorry replace :
$(document).ready(function() {
    $(".BtnSearchByState").click(function(){
        $(".divSub").hide();
        $(this).parent().next(".divSub").show();
    });
});

by :
replace :
$(document).ready(function() {
    $(".BtnSearchByState,.BtnSearchByCity,.BtnSearchByChurch").click(function(){
        $(".divSub").hide();
        $(this).parent().next(".divSub").show();
    });
});

0
 
LVL 82

Expert Comment

by:leakim971
ID: 36819107
try this one too :

$(document).ready(function() {
    $(".divMain").click(function(){
        $(".divSub").hide();
        $(this).next(".divSub:eq(0)").show();
    });
});

Open in new window

0
 

Author Comment

by:lulu50
ID: 36819114
it doesn't like the combination

(".BtnSearchByState,.BtnSearchByCity,.BtnSearchByChurch").
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36819123
>it doesn't like the combination

you paste the wrong code

use :
$(document).ready(function() {
    $(".BtnSearchByState,.BtnSearchByCity,.BtnSearchByChurch").click(function(){
        $(".divSub").hide();
        $(this).parent().next(".divSub").show();
    });
});

Open in new window

or :
$(document).ready(function() {
    $(".divMain").click(function(){
        $(".divSub").hide();
        $(this).next(".divSub:eq(0)").show();
    });
});

Open in new window

0
 

Author Comment

by:lulu50
ID: 36819125
It works great

leakim971

thank you so much for helping me.

This is great until my next question.
0
 

Author Closing Comment

by:lulu50
ID: 36819129
Great!!!!!

Thank you leakim971
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36819137
you're welcome, see you soon
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36890928
replace :
<script type="text/javascript" src="JS/jquery.min.js"></script>
<script type="text/javascript" src="JS/jquery-latest.min.js"></script>  
by :
<script type="text/javascript" src="JS/jquery-latest.min.js"></script>  
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now