Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Help me with Jquery

Help me with Jquery

Scheduled Pinned Locked Moved JavaScript
helpquestionjavascriptcsssysadmin
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nafiseh Salmani
    wrote on last edited by
    #1

    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=

    Z M C 3 Replies Last reply
    0
    • N Nafiseh Salmani

      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=

      Z Offline
      Z Offline
      ZurdoDev
      wrote on last edited by
      #2

      Yes, you can give your div an ID if that makes this easier. Just put a runat="server" tag on it and give it an ID and then you can access via ID.

      There are only 10 types of people in the world, those who understand binary and those who don't.

      1 Reply Last reply
      0
      • N Nafiseh Salmani

        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=

        M Offline
        M Offline
        Moykn
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        • N Nafiseh Salmani

          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=

          C Offline
          C Offline
          Crazy Kid
          wrote on last edited by
          #4

          when you trigger the button,you should cancel bubble.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups