I have a Jquery dialog box in my website. This dialog box is meant for getting user comments. At present, I'm using the following code to execute the Javascript function and is working fine:
**<a href="#dialog" name="modal">Rate this</a>**
<div id="dialog" class="window"></div>
<div id="mask"></div>
The Javascript code which it calls as follows:
$(document).ready(function() {
//select all the a tag with name equal to modal
$('a[name=modal]').click(function(e) {
//Cancel the link behavior
e.preventDefault();
//Get the A tag
var id = $(this).attr('href');
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({ 'width': maskWidth, 'height': maskHeight });
//transition effect
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow", 0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH / 2 - $(id).height() / 2);
$(id).css('left', winW / 2 - $(id).width() / 2);
//transition effect
$(id).fadeIn(2000);
});
});
//if close button is clicked
$("input[id$='btnClose']").click(function(e) {
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
Since href does not have server side click event, I need to call the javascript using the link button. I tried several ways but failed to get the actual result.
To Conclude I need to change this call **<a href="#dialog" name="modal">Rate this</a>**
to a Link button so that I can trap the click event.