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. ASP.NET
  4. Want to Hide a span element using class selector using CSS

Want to Hide a span element using class selector using CSS

Scheduled Pinned Locked Moved ASP.NET
csshelp
3 Posts 2 Posters 7 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.
  • I Offline
    I Offline
    indian143
    wrote on last edited by
    #1

    Hi All, I want to hide span which has class k-icon k-i-close but don't want to hide spam with class: k-icon k-i-edit,

    [Edit](#)
    
    
    	
    [Delete](#)
    

    I have tried in the below way:

    .k-button.k-button-icontext .k-icon, .k-button.k-button-icontext .k-image
    {
    visibility:hidden;
    }

    But it is hiding images of all buttons, but I want to only hide delete buttons image using css class. I have tried in the below way also but its not hiding the delete buttons icon, I just want to hide the delete buttons icon.

    function dataBoundAdmin(e)
    {
    var data = this.dataSource.view();
    for (var i = 0; i < data.length; i++)
    {
    var uid = data[i].uid;
    var row = this.table.find("tr[data-uid='" + uid + "']");

        if (data\[i\].IsValid)
        {            
            row.find(".k-grid-delete").contents().last()\[0\].textContent = 'Disable';
        }
        else
        {            
            row.find(".k-grid-delete").contents().last()\[0\].textContent = 'Enable';
        }
    }
    
    $(".k-icon k-i-close").hide();
    

    }

    Any help is going to be very helpful, thanks in advance. Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

    I Richard DeemingR 2 Replies Last reply
    0
    • I indian143

      Hi All, I want to hide span which has class k-icon k-i-close but don't want to hide spam with class: k-icon k-i-edit,

      [Edit](#)
      
      
      	
      [Delete](#)
      

      I have tried in the below way:

      .k-button.k-button-icontext .k-icon, .k-button.k-button-icontext .k-image
      {
      visibility:hidden;
      }

      But it is hiding images of all buttons, but I want to only hide delete buttons image using css class. I have tried in the below way also but its not hiding the delete buttons icon, I just want to hide the delete buttons icon.

      function dataBoundAdmin(e)
      {
      var data = this.dataSource.view();
      for (var i = 0; i < data.length; i++)
      {
      var uid = data[i].uid;
      var row = this.table.find("tr[data-uid='" + uid + "']");

          if (data\[i\].IsValid)
          {            
              row.find(".k-grid-delete").contents().last()\[0\].textContent = 'Disable';
          }
          else
          {            
              row.find(".k-grid-delete").contents().last()\[0\].textContent = 'Enable';
          }
      }
      
      $(".k-icon k-i-close").hide();
      

      }

      Any help is going to be very helpful, thanks in advance. Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

      I Offline
      I Offline
      indian143
      wrote on last edited by
      #2

      Ok no problem, I got it resolved in the following way:

      function dataBoundAdmin(e)
      {
      var data = this.dataSource.view();
      for (var i = 0; i < data.length; i++)
      {
      var uid = data[i].uid;
      var row = this.table.find("tr[data-uid='" + uid + "']");

          row.find(".k-i-close").hide();
      
          if (data\[i\].IsValid)
          {            
              row.find(".k-grid-delete").contents().last()\[0\].textContent = 'Disable';           
          }
          else
          {            
              row.find(".k-grid-delete").contents().last()\[0\].textContent = 'Enable';            
          }
      }   
      

      }

      Just say if somebody needs similar help. Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

      1 Reply Last reply
      0
      • I indian143

        Hi All, I want to hide span which has class k-icon k-i-close but don't want to hide spam with class: k-icon k-i-edit,

        [Edit](#)
        
        
        	
        [Delete](#)
        

        I have tried in the below way:

        .k-button.k-button-icontext .k-icon, .k-button.k-button-icontext .k-image
        {
        visibility:hidden;
        }

        But it is hiding images of all buttons, but I want to only hide delete buttons image using css class. I have tried in the below way also but its not hiding the delete buttons icon, I just want to hide the delete buttons icon.

        function dataBoundAdmin(e)
        {
        var data = this.dataSource.view();
        for (var i = 0; i < data.length; i++)
        {
        var uid = data[i].uid;
        var row = this.table.find("tr[data-uid='" + uid + "']");

            if (data\[i\].IsValid)
            {            
                row.find(".k-grid-delete").contents().last()\[0\].textContent = 'Disable';
            }
            else
            {            
                row.find(".k-grid-delete").contents().last()\[0\].textContent = 'Enable';
            }
        }
        
        $(".k-icon k-i-close").hide();
        

        }

        Any help is going to be very helpful, thanks in advance. Thanks, Abdul Aleem "There is already enough hatred in the world lets spread love, compassion and affection."

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        If you want to hide .k-i-close but not .k-i-edit, then you need a rule that targets .k-i-close:

        .k-button.k-button-icontext .k-i-close
        {
        visibility:hidden;
        }

        If you want to do it using jQuery, you'll need a valid selector. Your example is looking for an element called <k-i-close> which is a descendant of an element with class="k-icon" - that doesn't match your markup. Try:

        $(".k-icon.k-i-close").hide();

        Class Selector (“.class”) | jQuery API Documentation[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        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