Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1105425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:37:51+00:00 2026-05-17T01:37:51+00:00

I need to dynamically alter a variable with the name attribute from a link

  • 0

I need to dynamically alter a variable with the “name” attribute from a link – code below…

       <input type="text" class="datepicker" id="dp1">

       <a href="javascript:;" class="tab" name="1,2">test button</a>

and

$(document).ready(function(){

    var pickable = { dp1: [4,5,6] };

    $(".tab").click(function () { 
        var test = $(this).attr("name").split(",");
        pickable = { dp1:  test  };
    });

    $(".datepicker").each(function() {
        $(this).datepicker({
            beforeShowDay: function(date){ 
                var day = date.getDay(), days = pickable[this.id];
                return [$.inArray(day, days) > -1, ""];
            },
        });
    });

});​

Any ideas why this doesn’t work??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:37:51+00:00Added an answer on May 17, 2026 at 1:37 am

    You can try something like this

    $(document).ready(function(){
    
    var pickable = ["2","3","4","5"];
    
    function closedDays(date){
        var sDate = date.getDay().toString();
        if ($.inArray(sDate, pickable) == -1) return [false,"",""];
        else return [true, ""];
    }
    
    $(".tab").click(function () { 
       pickable =  $(this).attr("name").split(",");
         closedDays;
    });
    
    $(".datepicker").each(function() {
        $(this).datepicker({
            beforeShowDay:  closedDays
        });
    });
    });​
    

    You can try it here http://jsfiddle.net/ZKW3b/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable from which I need to dynamically generate nodes <xsl:template match=banner_discount_1
I need to dynamically create textbox. This is my code, but with this I
We need to dynamically create (i.e. during runtime, via code-behind) UserControls and position them
I need to dynamically insert an image in my JS code. In my Razor
Can I build a class as shown below dynamically using reflection? There are no
I need to add components dynamically. Moreover, I need to alter the layout dynamically.
I used ActiveRecord::Base.set_table_name to set my table name on a dynamically created ActiveRecord class.
I need to dynamically generate radio or checkbox by jQuery. I use the following
I need to dynamically build a list of textboxes using javascript and jquery. The
I need to dynamically load banner images into a HTML5 app and would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.