Help me with Jquery
-
this is a jquery question, I am not sure if this is a correct forum to post it though. There is a DIV tag with many elements inside. the div tag has a class to add jquery function to manage mouseover, mouseleave and click event to redirect to another page. everything works great till now. The problem is, now I have to add a button inside the div which should have its own function different from the div click. I would appreciate if anybody can help me. please note that I can't use the elements id, since the div is inside a repeater. here are my Jquery code:
$('.Status').click(function() {
$(this).attr('data-redirect', '1');}); $('.Highlight').click(function() { var type = $(this).attr('data-DailyViewType'); var typeid = $(this).attr('data-editurl'); var btn\_status = $(this).find('data-redirect'); if ($(this).hasClass('Status')) { alert(1); } if (type != undefined || type != null) { window.location = 'RuleEdit.aspx?DailyRuleTypeID=' + type; } else { if (typeid != undefined || typeid != null) { if (typeid > 0 && btn\_status != 1) { window.location = 'RuleEdit.aspx?id=' + typeid; } else { } } } }); $('.Highlight').mouseover(function() { $(this).css('border-left-color', '#FF9900'); $(this).css('background-color', '#FAFAFA'); }); $('.Highlight').mouseleave(function() { $(this).css('border-left-color', 'White'); $(this).css('background-color', 'White'); });
<asp:Repeater ID="RptRulesAndAlerts" runat="server" onitemdatabound="RptRulesAndAlerts_ItemDataBound" > <ItemTemplate> <div class="tabs-content Highlight " align="center" data-editurl='<%# DataBinder.Eval(Container.DataItem, "RuleAlertID") %>'> <asp:Panel ID="RuleAlert" runat="server"> <table cellpadding="7" cellspacing="7" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CDCDCD ; font-size: 11px; "> <tr valign="middle"> <td><asp:Panel ID=
-
this is a jquery question, I am not sure if this is a correct forum to post it though. There is a DIV tag with many elements inside. the div tag has a class to add jquery function to manage mouseover, mouseleave and click event to redirect to another page. everything works great till now. The problem is, now I have to add a button inside the div which should have its own function different from the div click. I would appreciate if anybody can help me. please note that I can't use the elements id, since the div is inside a repeater. here are my Jquery code:
$('.Status').click(function() {
$(this).attr('data-redirect', '1');}); $('.Highlight').click(function() { var type = $(this).attr('data-DailyViewType'); var typeid = $(this).attr('data-editurl'); var btn\_status = $(this).find('data-redirect'); if ($(this).hasClass('Status')) { alert(1); } if (type != undefined || type != null) { window.location = 'RuleEdit.aspx?DailyRuleTypeID=' + type; } else { if (typeid != undefined || typeid != null) { if (typeid > 0 && btn\_status != 1) { window.location = 'RuleEdit.aspx?id=' + typeid; } else { } } } }); $('.Highlight').mouseover(function() { $(this).css('border-left-color', '#FF9900'); $(this).css('background-color', '#FAFAFA'); }); $('.Highlight').mouseleave(function() { $(this).css('border-left-color', 'White'); $(this).css('background-color', 'White'); });
<asp:Repeater ID="RptRulesAndAlerts" runat="server" onitemdatabound="RptRulesAndAlerts_ItemDataBound" > <ItemTemplate> <div class="tabs-content Highlight " align="center" data-editurl='<%# DataBinder.Eval(Container.DataItem, "RuleAlertID") %>'> <asp:Panel ID="RuleAlert" runat="server"> <table cellpadding="7" cellspacing="7" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CDCDCD ; font-size: 11px; "> <tr valign="middle"> <td><asp:Panel ID=
-
this is a jquery question, I am not sure if this is a correct forum to post it though. There is a DIV tag with many elements inside. the div tag has a class to add jquery function to manage mouseover, mouseleave and click event to redirect to another page. everything works great till now. The problem is, now I have to add a button inside the div which should have its own function different from the div click. I would appreciate if anybody can help me. please note that I can't use the elements id, since the div is inside a repeater. here are my Jquery code:
$('.Status').click(function() {
$(this).attr('data-redirect', '1');}); $('.Highlight').click(function() { var type = $(this).attr('data-DailyViewType'); var typeid = $(this).attr('data-editurl'); var btn\_status = $(this).find('data-redirect'); if ($(this).hasClass('Status')) { alert(1); } if (type != undefined || type != null) { window.location = 'RuleEdit.aspx?DailyRuleTypeID=' + type; } else { if (typeid != undefined || typeid != null) { if (typeid > 0 && btn\_status != 1) { window.location = 'RuleEdit.aspx?id=' + typeid; } else { } } } }); $('.Highlight').mouseover(function() { $(this).css('border-left-color', '#FF9900'); $(this).css('background-color', '#FAFAFA'); }); $('.Highlight').mouseleave(function() { $(this).css('border-left-color', 'White'); $(this).css('background-color', 'White'); });
<asp:Repeater ID="RptRulesAndAlerts" runat="server" onitemdatabound="RptRulesAndAlerts_ItemDataBound" > <ItemTemplate> <div class="tabs-content Highlight " align="center" data-editurl='<%# DataBinder.Eval(Container.DataItem, "RuleAlertID") %>'> <asp:Panel ID="RuleAlert" runat="server"> <table cellpadding="7" cellspacing="7" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CDCDCD ; font-size: 11px; "> <tr valign="middle"> <td><asp:Panel ID=
Try this
//Use the selector you want
$('button').click(function(e){
e.stopPropagation();//your code
})
if what you need on mouseover/mouseleave is just change css, do it using css
/* Normal State*/
.highlight{
border-left: #FFF;
background-color:#FFF;
}/*Hover State*/
.highlight:hover {
border-left: #FF9900;
background-color:#FAFAFA;
}Sorry, my english is bad!
-
this is a jquery question, I am not sure if this is a correct forum to post it though. There is a DIV tag with many elements inside. the div tag has a class to add jquery function to manage mouseover, mouseleave and click event to redirect to another page. everything works great till now. The problem is, now I have to add a button inside the div which should have its own function different from the div click. I would appreciate if anybody can help me. please note that I can't use the elements id, since the div is inside a repeater. here are my Jquery code:
$('.Status').click(function() {
$(this).attr('data-redirect', '1');}); $('.Highlight').click(function() { var type = $(this).attr('data-DailyViewType'); var typeid = $(this).attr('data-editurl'); var btn\_status = $(this).find('data-redirect'); if ($(this).hasClass('Status')) { alert(1); } if (type != undefined || type != null) { window.location = 'RuleEdit.aspx?DailyRuleTypeID=' + type; } else { if (typeid != undefined || typeid != null) { if (typeid > 0 && btn\_status != 1) { window.location = 'RuleEdit.aspx?id=' + typeid; } else { } } } }); $('.Highlight').mouseover(function() { $(this).css('border-left-color', '#FF9900'); $(this).css('background-color', '#FAFAFA'); }); $('.Highlight').mouseleave(function() { $(this).css('border-left-color', 'White'); $(this).css('background-color', 'White'); });
<asp:Repeater ID="RptRulesAndAlerts" runat="server" onitemdatabound="RptRulesAndAlerts_ItemDataBound" > <ItemTemplate> <div class="tabs-content Highlight " align="center" data-editurl='<%# DataBinder.Eval(Container.DataItem, "RuleAlertID") %>'> <asp:Panel ID="RuleAlert" runat="server"> <table cellpadding="7" cellspacing="7" style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #CDCDCD ; font-size: 11px; "> <tr valign="middle"> <td><asp:Panel ID=