Tuesday, 26 December 2017

How to swap div(or any jquery selector) element using jquery ID selector


$(function() {

  //var getCountryPath = window.location.host.split(".")[0];
  var getCountryPath="qa"
  console.log(getCountryPath);
  console.log("mahesh");
  console.log("path is ",getCountryPath);

  //qtr  oman  uae   india
  if(getCountryPath == "qa")
  {
// if your fist div is qa then no need to swap it by default come first , please change the code according to your requirement. 
  }

  if(getCountryPath == "in")
  {
    var india = $("#india").html();
    var qtr = $("#qtr").html();
    $("#qtr").html(india);
    $("#india").html(qtr);
  }

  if(getCountryPath == "om")
  {
    var oman = $("#oman").html();
        var qtr = $("#qtr").html();
    $("#qtr").html(oman);
        $("#oman").html(qtr);
  }

  if(getCountryPath == "uae")
  {
    var uae = $("#uae").html();
        var qtr = $("#qtr").html();
    $("#qtr").html(uae);
        $("#uae").html(qtr);
  }
});

No comments:

Post a Comment

Django rest api - filter

views.py from django_filters.rest_framework import DjangoFilterBackend class PollList(viewsets.ModelViewSet):     queryset = X.objects...