0

The dropdownlist is showing when it is clicked, and working fine. I would just like the dropdownlist shown when the page originally is loaded.

I have tried using the .click(), .mousedown(), and using the Jquery Animate library, with no luck. And, I know the Javascript needs to go in a .ready function, I'm not worried about that part. More just how to automatically show it.

When inspecting the element in Chrome Dev tools it is outside the flow of the body (not highlighted when body is selected) and I dont see any css changes that would show or hide the dropdown list.

The code in the view looks like this:

<div class="jump-practice" id="JumpToChoiceDropdown">
    @Html.DropDownListFor(m => m.SelectedChoiceUrl, Model.ChoiceItems, "Make a Choice", new {@id="ShowThisList", datasource = "choice" })
    <label></label>
</div>
bkoenig
  • 45
  • 7
  • what do you mean by *dropdownlist is showing when it is clicked*? is your dropdown getting generated but not visible on page load? – Sushil Aug 05 '15 at 17:31
  • Do you mean expand the select options? Simulating a click on a select element will not open the drop down list. – Tyler Aug 05 '15 at 17:40
  • possible duplicate of [How can you programmatically tell an HTML SELECT to drop down (for example, due to mouseover)?](http://stackoverflow.com/questions/249192/how-can-you-programmatically-tell-an-html-select-to-drop-down-for-example-due) – Jasen Aug 05 '15 at 17:40
  • @Sushil - The dropdown list is getting generated, and when you click the dropdown it works as expected. – bkoenig Aug 05 '15 at 17:56
  • Then you failed to mention that and it would be helpful to providing a solution. The jsfiddles in that posting work so you need to give us a more complete example so the problem can be replicated. – Jasen Aug 05 '15 at 18:05

1 Answers1

1

My error was outside of jquery and the element I had originally been working with. I needed to put the javascript I was using in the partial view with my dropdownlist and not in the page that was using that partial view.

Thanks.

bkoenig
  • 45
  • 7