- jQuery(document).ready(function($){
- if($("#sign-up-role").val() == "seller"){
- $(".buyer-seller-text").text("sellers");
- $(".buyer-seller-arrow").css({"top": "40%", "border-width": "0px 6px 7px 6px", "border-color": "transparent transparent #45BA80"});
- $(".buyer-field").hide();
- $(".seller-field").show();
- $(".buyer-field select").prop('required', false);
- $(".buyer-field input").prop('required', false);
- $(".seller-field textarea").prop('required', true);
- }
- $(".buyer-seller-switcher").click(function(){
- var now_role = $(this).attr("data-value");
- if(now_role=="buyer"){
- $(this).attr("data-value", "seller");
- $("#sign-up-role").val("seller");
- $(".buyer-seller-text").text("sellers");
- $(".buyer-seller-arrow").css({"top": "40%", "border-width": "0px 6px 7px 6px", "border-color": "transparent transparent #45BA80"});
- $(".buyer-field").hide();
- $(".seller-field").show();
- $(".buyer-field select").prop('required', false);
- $(".buyer-field input").prop('required', false);
- $(".seller-field textarea").prop('required', true);
- }
- else{
- $(this).attr("data-value", "buyer");
- $("#sign-up-role").val("buyer");
- $(".buyer-seller-text").text("buyers");
- $(".buyer-seller-arrow").css({"top": "45%", "border-width": "7px 6px 0px 6px", "border-color": "#45BA80 transparent transparent"});
- $(".buyer-field").show();
- $(".seller-field").hide();
- $(".buyer-field select").prop('required', true);
- $(".buyer-field input").prop('required', true);
- $(".seller-field textarea").prop('required', false);
- }
- });
- });
Raw Paste