title: Using JavaScript to create custom welcome
body: <p>I am using a script in a SharePoint content editor web part (CEWP) that welcomes the user to the site based on name and time of day and then has another link as well.  I am having issues with formatting it.  I have customzed my working script but for some reason the font size and color has not worked properly.  Can someone point me in the right direction?  I think it has to do with my 'var WelcomeMenuContent' but am not sure.</p>
  
  <p>Any help is appreciated as always:</p>
  
  <pre><code>&lt;script type="text/javascript" src="https://wss.companyabc.org/sites/WSS001905/SiteAssets/Libraries/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  
  &lt;style type="text/css"&gt;
  #Header {
  font-family: Arial;
  color: #cc0717;
  font-size: 3em;
  text-decoration: underline;
  }
  #SubHeader {
  font-family: Arial;
  color:#000000;
  font-size: 1.5em;
  }
  #Hyperlink{
  font-family: Arial;
  color:#cc0717;
  weight: bold;
  font-size: 1em;
  }
  &lt;/style&gt;
  
  &lt;center&gt;
  &lt;div class="Header"&gt;
  &lt;span id="greeting"&gt;Hello&lt;/span&gt;
  &lt;script type = "text/javascript"&gt;
      $(document).ready(function(){
          var WelcomeMenuContent = $('.ms-welcomeMenu &gt; a.ms-menu-a &gt; span');
          var UserName = WelcomeMenuContent.text();
          var FirstName = UserName.split(" ")[0];
          var Display;
          var Digital = new Date()
          var Hours = Digital.getHours()
  
          Morning = 'Good morning' + " " + FirstName;
          Lunch = 'Good afternoon' + " " + FirstName;
          Evening = 'Good evening' + " " + FirstName;
          Night = 'Good night' + " " + FirstName;
          TimeElse = 'Welcome' + " " + FirstName;
  
              if (Hours &gt;= 5 &amp;&amp; Hours &lt;= 11) 
                  document.getElementById("greeting").innerHTML=(Morning);
                      else if (Hours &gt;= 12 &amp;&amp; Hours &lt;= 17) 
                  document.getElementById("greeting").innerHTML=(Lunch);
                      else if (Hours &gt;= 18 &amp;&amp; Hours &lt;= 22) 
                  document.getElementById("greeting").innerHTML=(Evening);
                      else if (Hours &gt;= 23 &amp;&amp; Hours &lt;= 4) 
                  document.getElementById("greeting").innerHTML=(Night);
              else
                  document.getElementById("greeting").innerHTML=(TimeElse);
      }); 
  &lt;/script&gt;
  &lt;/div&gt;
      &lt;div class="SubHeader"&gt;
          &lt;span&gt;Welcome to the home of Company ABC&lt;/span&gt;
      &lt;/div&gt;
  &lt;/br&gt;
  &lt;hr&gt;
  &lt;/br&gt;
      &lt;div class="Hyperlink"&gt;
          &lt;a href="http://www.google.com"&gt;Click here to continue to the  Community SharePoint Site&lt;/a&gt;
      &lt;/div&gt;
  &lt;hr&gt;
  &lt;/br&gt;
  
  &lt;/center&gt;
  </code></pre>