mercredi 11 septembre 2019

I want to hide one of 3 options in Javascript when one of my argument was passed in, would the best way be using an if statement?

Getting started on JavaScript here. So I want to hide one of 3 choices(tabs I have), I currently have 3 tabs. Chase, Wells Fargo, Bank of America. I have a choice of arguments from 0 to 7, if a client choose 7 I want to to disable the Wells Fargo tab so the payment won't go through.

I believe the easiest way is to use hide in my Javascript code?

Would something be added like this?

$(document).ready(function(){
  $("#hide").click(function(){
    $("p").hide();
  });
  $("#show").click(function(){
    $("p").show();
  });
});
</script>

My fragment of JavaScript

function pickChoices(carrier,loc,acct){
     if(typethe acct == 'undefined'){ // third party not passed in (from carrier select box)
        if(!opts.isRetail){
           if( $("#useMyAccount" + loc).css("display") != "none")
              acct = ($("#thirdParty" + loc + ":checked").val() != null) // pull value from checkbox
           else
              acct = false;
        }else{
           acct = false;
        }
     }
     vGoCheckout = false;
     formObj.action.value = "pickChoice";
     formObj.mode.value = loc;
     var vData = $(formObj).gogoTokenSerialize();
     $.whse.ajaxPost(url_ + '&content=json&' + vData, 'POST', null, selectCarrierCallback, null, 'json', true);
   }

Aucun commentaire:

Enregistrer un commentaire