treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Remove Content after (

  • I have Content like Casual User (Standard Reports) Power User(SQL/Direct)

    Can I remove (Standard Reports) after Casual User and (SQL/Direct) after Power User i.e I should have content like Casual User Power User after CSS is applied. Please tell me what to do

    Please see the below link to see my page

    http://i.imgur.com/oMqJxvb.jpg

  • You would have to use JavaScript or some sort of server-side language to accomplish this. It can't be done with CSS alone.

    JavaScript:

    element.innerHTML = element.innerHTML.replace(/\((.*?)\)/g, '');
    

    PHP:

    echo preg_replace('/\((.*?)\)/g', null, $text);
    
  • You could also use PHP Substring.

  • You could use nth-child in your CSS to hide them.

  • I don't understand. Are the labels not changeable at ALL?

    How are they generated?

  • Is there some reason we can't do something like:

    <input type="checkbox" id="casual">
    <label for="casual">Casual User <span>(Standard Reports)</span> </label>
    
    #casual + label span {
      display:none;
    }
    
  • Could even use attribute selectors if the labels are set up properly.

      input#check-you-want-to-hide { display: none; }
      label[for="check-you-want-to-hide"] {display: none;}