DropDownList’s SelectedIndexChanged event not firing

I have a DropDownList object in my web page. When I click on it and select a different value, nothing happens, even though I have a function wired up to the SelectedIndexChanged event. First, the actual object’s HTML code: <asp:DropDownList ID=”logList” runat=”server” onselectedindexchanged=”itemSelected”> </asp:DropDownList> And this is that function, itemSelected: protected void itemSelected(object sender, EventArgs … Read more

Get selected option text with JavaScript

I have a dropdown list like this: <select id=”box1″> <option value=”98″>dog</option> <option value=”7122″>cat</option> <option value=”142″>bird</option> </select> How can I get the actual option text rather than the value using JavaScript? I can get the value with something like: <select id=”box1″ onChange=”myNewFunction(this.selectedIndex);” > But rather than 7122 I want cat. 16 Answers 16

How to get multiple selected values of select box in php?

I have a html form which has a select list box from which you can select multiple values because its multiple property is set to multiple. Consider form method is ‘GET’. The html code for the form is as follows: <html> <head> <title>Untitled Document</title> </head> <body> <form id=”form1″ name=”form1″ method=”get” action=”display.php”> <table width=”300″ border=”1″> <tr> … Read more

How to style the option of an html “select” element?

Here’s my HTML: <select id=”ddlProducts” name=”ddProducts”> <option>Product1 : Electronics </option> <option>Product2 : Sports </option> </select> I want to make the name of the product (i.e. ‘Product1’, ‘Product2’ , etc) bold, and its categories(viz. Electronics, Sports, etc) italicized, using CSS only. I found an old question that mentioned it’s not possible using HTML and CSS, but … Read more

Avoid dropdown menu close on click inside

I have a Twitter Bootstrap dropdown menu. As all Twitter Bootstrap users know, the dropdown menu closes on click (even clicking inside it). To avoid this, I can easily attach a click event handler on the dropdown menu and simply add the famous event.stopPropagation(). <ul class=”nav navbar-nav”> <li class=”dropdown mega-dropdown”> <a href=”https://stackoverflow.com/questions/25089297/javascript:;” class=”dropdown-toggle” data-toggle=”dropdown”> <i … Read more