jQuery addClass example

Change class name on click in jQuery

by dshilkret

HTML

<div>
<script type="text/javascript">

$(document).ready(function () {
var soapEnv = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
  <soap:Body> \
    <Login xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
      <username>username1</username> \
      <password>password</password> \
    </Login> \
  </soap:Body> \
</soap:Envelope>"

// Call web service
$.ajax({
url: "http://servername:serverport/_vti_bin/authentication.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processListAccessResult,
contentType: "text/xml; charset=\"utf-8\""
});
});

// Process result
function processListAccessResult(xData, status) {
alert(xData);
alert(status);
}

</script>

<ul id="data"></ul> 

</div>

CSS

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#banner-message {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  font-size: 25px;
  text-align: center;
  transition: all 0.2s;
  margin: 0 auto;
  width: 300px;
}

button {
  background: #0084ff;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  font-size: 15px;
  color: #fff;
}

#banner-message.alt {
  background: #0084ff;
  color: #fff;
  margin-top: 40px;
  width: 200px;
}

#banner-message.alt button {
  background: #fff;
  color: #000;
}