0

I'm using uikit and to open a dropdown i can set some attributes like:

data-uk-dropdown="{mode:'click',justify:'#my-id',}" 

this kind of way it's usable from html view in the input. Is it possible use the justify directly from javascript? I mean something like:

 $(document).on('focusin', '#my-id', function () {
        $('.uk-dropdown').justifly('#my-id');
    });

of course $('.uk-dropdown').justifly('#my-id'); it's not the correct way and it's not working.

2
  • which is the plugin used.. do you have a link to that plugin Commented May 28, 2015 at 10:18
  • I'm using Uikit @ArunPJohny Commented May 28, 2015 at 10:19

1 Answer 1

3

You need to use .attr() for setting the attribute value:

 $('.uk-dropdown').attr('justifly','#my-id');

for setting multiple attributes:

  $('.uk-dropdown').attr({'mode':'click','justify':'#my-id'});
Sign up to request clarification or add additional context in comments.

3 Comments

mmh seems the correct solution but try to see here: jsfiddle.net/8y48q/51 not works :(
Try in this way: jsfiddle.net/8y48q/52 i still can't justify the dropdown when i click on the input text. If you click on the right button it is justified
have you tried to click in the input text? See the difference between the click on the button and from the input. If you click in the input text for first you will see that the drodown is smaller that the input. Then, click in the button on the right of the input text. You will see the dropdown at the same width of the input text. I need do this via javascript

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.