Solved

Help I need help Please

Posted on 2011-09-29
22
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Suggested Courses

738 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