I checked previous questions, but does not get any help. I write this script in my header file:
<script type="text/javascript">
$(function () {
var as= $("#dialog1").dialog({
autoOpen: false,
height:700,
width:700
});
$("#register").unbind().click(function () {
var url="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=site/register";
as.load(url).dialog("open");
});
$("#login").unbind().click(function () {
alert("click on login fired.");
var url="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=site/login";
as.load(url).dialog("open");
});
$(".ui-state-default .ui-icon").click(function () { as.dialog("close");});
$(".com").unbind().click(function () {
var element = $(this);
var id = element.attr("id");
var url='<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=video/comments&video_id='+id;
as.load(url).dialog("open");
});
$(".smile").unbind().click(function () {
var element = $(this);
var id = element.attr("id");
var url="<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=video/smiles&video_id="+id;
as.load(url).dialog("open");
});
});
</script>
'Login' and 'Register' click events for header, And remaining two events for another page. when i go to that page, i first i click on 'login' after that again i click on login, click event calls only one time, But when i click third time on 'login', then login click event fire three times, Again when i click on this, Then number of fire events on login increase. can anybody tel me the reason behind this?