Posts

javascript validate form by separate by comma

Use variable with javascript inner HTML   var str = document.getElementById("elementID").value var res = str.split(" ") res.length Script javascript  <script type="text/javascript"> function valicontact() {   var x = document.getElementById("inputFirstname").value;   var res = x.split(",")   var y = document.getElementById("signum").value;   var ress = y.split(",")   var z = document.getElementById("Contactno").value;   var resss = z.split(",")   var n = res.length   var s = ress.length   var c = resss.length   if (s == c && s == n){   Sbutton.style.display = "block";   document.getElementById("errormessage").innerHTML = ""   } else {   document.getElementById("errormessage").innerHTML = "Number of Name,Signum and Contact should be same <br> name =" + n + "<br> Signum = " + s + "<br> Contact =" +c

django ajax using jquery and Jasonresponse

  +++++++++++++++++++++++ Template  {% block javascript %}     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>     <script>         $(document).ready(function () {             // catch the form's submit event             $('#changelogs').submit(function () {                 // create an AJAX call                 $.ajax({                     data: $(this).serialize(), // get the form data                     type: $(this).attr('method'), // GET or POST                     url: "{% url 'logs' %}",                     // on success                     success: function (response) {                         alert("Thankyou for reaching us out " + response.id);                     },                     // on error                     error: function (response) {                         // alert the error if any error occured                         alert(response.responseJSON

Sticky footer

 <footer class="bg-light text-center text-lg-start" style="position: fixed; left: 0; bottom: 0; width: 100%; text-align: center;">   <!-- Copyright -->   <div class="text-center p-2" style="background-color: rgba(0, 0, 0, 0.2);">     © 2021 Copyright:     <a class="text-dark" href="#">explinux.com</a>   </div>   <!-- Copyright --> </footer> See the example  © 2021 Copyright: explinux.com

javascript if else statement

 <script type="text/javascript">     function ShowHideDiv() {         var approvalatt = document.getElementById("approvalatt");         var Attachmail = document.getElementById("Attachmail");         if (approvalatt.value === "No"){         Attachmail.style.display = "block";         }else {         Attachmail.style.display = "none";     }     } </script> This section will work on java script  <select class="form-select rounded-pill bg-light" aria-label="approvalatt" name="approvalatt" id="approvalatt" onchange=ShowHideDiv() required>                         <option value="No" selected>No</option>                         <option value="Yes">Yes</option>                         </select> Demo No Yes

file upload django

 # vi settings STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, "static/") #Manage static for IMS MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') -------------------------------------------------------------------------------- # vi urls.py   project wale me path('useraccess/',include('useraccess.urls')), ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ------------------------------------------------------------ # vi models  app wala model hai ye Create your models here. class Document(models.Model):     title = models.CharField(max_length = 30, default="")     uploadedFile = models.FileField(upload_to = "useraccess/file",default="")     dateTimeOfUpload = models.DateTimeField(auto_now = True) ---------------------------------------------------------------------------- # vi HTML  <form action="." method="POST" enctype="multipart/form
create counter check html

20 python library

Image
  20 Python Packages That You Must Try That Makes Your Life Easier Python is the most used programming language in the world of programming. It is one of the best choices for a beginner. The thing that attracts people towards python is simplicity and easy syntax. Python is an interpreted language so it becomes much easier to find bugs in the code. It is created by Guido van Rossum and first released in 1991, and since then the community of python developers is rising day by day with a large number of people. According to some resources, python has a community of over 10 million people. It is used by many multi-billion companies like Google, Amazon, Facebook, and more. I am using python for the last 1 and a half years, and the thing that I most like about python is its  One-Liners  and Packages,  and it is also the reason for me choosing python over any other language. In this blog, I will introduce you to the 15 python packages that are very useful and you must try them.  Let’s start.