[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

click event

Posted on 2013-07-01
4
Medium Priority
?
265 Views
Last Modified: 2013-07-01
The iphosting site should function like the seodhost site... but i put some code for the "+" sign to click and toggle like the seodhost site but it does not...there is no error in the console either so im not sure why this is happening.

http://iphosting.info/about/index.html

<script type="text/javascript">
//$(document).ready(function(){
	$("#title").bind("click",function(){

		alert('hello');
	});
//});


</script>

Open in new window






http://www.seodhost.com/about/index.html
0
Comment
Question by:Moizsaif123
[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
  • 3
4 Comments
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 39289991
Your 'document ready' block is commented out !
0
 
LVL 44

Accepted Solution

by:
Chris Stanyon earned 2000 total points
ID: 39290028
Hmmm - just looked at the code for both sites and the code you've posted above is not what is used for the + click. On the seodhost site you have the following in the head:

<script type="text/javascript">
   function CallShowHideDivContentAboutUs(id_about) {
      //Show div and reset all others
      $("#"+id_about).slideToggle(975).siblings(id_about).slideUp("slow");
   }
</script>

Open in new window

You don't have that in the other site.
0
 
LVL 4

Author Comment

by:Moizsaif123
ID: 39290230
This solution works although it should work with the code below as well...not sure why..

$("#bg_about").click(function()
alert('hello');
});

Open in new window

0
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 39290253
The code you've posted above is missing an opening curly bracket. It should be:

$("#bg_about").click(function() {
     alert('hello');
});

Open in new window

Rather than adding a click event to each title, why not just add the event based on class, and attach the event in jQuery rather than the inline onClick event. It keeps it all alot neater. Have a play with this:

http://jsfiddle.net/ChrisStanyon/rraPE/
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
The viewer will learn how to dynamically set the form action using jQuery.
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)
Suggested Courses

649 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