Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select from dropdown using outside click link #29

Open
WebDesignWorx opened this issue Jul 14, 2020 · 4 comments
Open

Select from dropdown using outside click link #29

WebDesignWorx opened this issue Jul 14, 2020 · 4 comments
Assignees

Comments

@WebDesignWorx
Copy link

WebDesignWorx commented Jul 14, 2020

Hello,
I like this script very much but there is something I can't make work.

For a simple Element within a Form I have a outside link with which I can select the option item by the use of a click. Is there a simple way I could make it work? Thanks in advance.

@WebDesignWorx
Copy link
Author

This is the Code/Function I am using on the simple select.
However, when I convert the select box to Selectator, it doesn't work anymore.

function add_child_page(page_id) {
    //find and select the page in the parent dropdown
    var selectBox = document.add_page.parent; // form name and select-box id
    for (var i = 0; i < selectBox.options.length; i++) {
        if (selectBox.options[i].value == page_id) {
            selectBox.selectedIndex = i;
            break;
        }
    }
    document.add_page.menu_title.focus(); //set focus to add_page form
}

@jogvana
Copy link

jogvana commented Jul 14, 2020

Thanks for your feedback! We'll look into this asap.

@WebDesignWorx
Copy link
Author

WebDesignWorx commented Jul 15, 2020

Thank you!

This code is what I am trying right now, but it doesn't work.
I will work on it too, schould I find a solution before you come back to me I will share here.

<li rel="1"><a href="#" class="add_child">[add child]</a></li>    
<li rel="2"><a href="#" class="add_child">[add child]</a></li>  
<li rel="3"><a href="#" class="add_child">[add child]</a></li>

    $("a.add_child").click(function(e){
        e.preventDefault();  
        var iID = $(this).closest('li').attr('rel');
        var sTarget = '#selectator_parent .selectator_option .selectator_value_' + iID;
        $(sTarget).trigger( "click" );
    });

The LI element is adding the class active (in FireBug) but unfortunately the select-box doesn't show the change.

@WebDesignWorx
Copy link
Author

Any chance we can make it work?
I tried for quite some time, but jQuery and JS is something I can't master all too much.
Thanks for any hints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants