nicoschuck nicoschuck - 1 year ago 92
jQuery Question

JS Toggle doesnt works

i need some help with my website.
I want to integrate the jquery toggle function. But it doesnt works.
I have not a lot experience with jquery.

Here is my code:

<a href="javascript:toggle('exp');">Klick</a>

<div id="exp" style="display:none;"> hallo </div>

<script src="jquery-ui-1.10.3/js/jquery-1.9.1.js"></script>
<script src="jquery-ui-1.10.3/js/jquery-ui-1.10.3.custom.js"></script>
function toggle(str)

Has anyone an idea why it doesnt works?

Answer Source

Missing # before id selector in your code.

function toggle(str){
    $('#' + str).slideToggle('slow');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download