Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya
 asked on

Get the dropdown title in jquery

Hi Experts,
 @Html.FacetDropDownList("ID", Model.ID, new { @class = "special-dropdown", title = T("Select a student").Text })

Open in new window


Is there anyway I can access this title in jquery?

Thanks in advance!
.NET MVCC#jQuery

Avatar of undefined
Last Comment
Julian Hansen

8/22/2022 - Mon
Julian Hansen

Yes - two ways I can see.

The one is by the class

$('.special-dropdown');

Open in new window

The other by the id
$('#<%=Model.ID%>');

Open in new window


We would need to know
a) How this component renders in the HTML page
b) What you want to do with the it

To be able to give you more.

Can you post what the rendered HTML looks like and let us know what you want to do with the title - do you just want to get the text?
RadhaKrishnaKiJaya

ASKER
Thank you for trying to help me!
This is how it is rendered.
<input id="StudentType" name="StudentType" type="hidden" value="Regular" />    <div style="display:none;">
<div id="StudentDiv">
<div class="facet-dropdown"><select class="special-dropdown test-dropdown" id="StudentId" name="StudentId" title="Select a student">
<option value="9999">Test1</option>
<option value="8888">Test2</option>
<option value="8881">Test3</option>
</select>
</div>

</div>
    
</div>

Open in new window


I want that title -"Select a student"
ASKER CERTIFIED SOLUTION
Julian Hansen

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
RadhaKrishnaKiJaya

ASKER
Thank you very much!! It worked!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Julian Hansen

You are welcome.