ASP.NET & JQuery example

Below is an example of how you have to reference a DIV within your asp file, to call a JQuery function.

<script type=”text/javascript”>

var $j = jQuery.noConflict();

$j(document).ready(function () {

$j(“#employee_info_showhide”).click(function () {

$j(“#employee_info_showhide”).toggleClass(“hide”);

$j(“#employee_table_div”).slideToggle(‘medium’);

});

</script>

When the ASP file get’s compiled, each ID of each HTML component gets a unique identifier appended to the end of the name, so you can’t reference the ID’s directly, you have to tell the compiler to add the indentifier to your JavaScript as well with the   “#name” declaration.