Link to home
Start Free TrialLog in
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!
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

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?
Avatar of RadhaKrishnaKiJaya
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
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much!! It worked!
You are welcome.