Click here to Skip to main content
16,012,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
iam have 3 dropdwon list if any one dropdown list onchange event fire. then i want three dropdown id name in jquery

What I have tried:

<select ></select>

<select ></select>

<select >
</select>
var curid=chart0Filter3drop;
for(var i=0;i<3;i++)
{
curid =curid+i;
var name=$.trim($("[id*='" + curid + "']").name());
alert(name);
}
Posted
Updated 19-Aug-16 3:35am

<select id="sel1">
    <option>A</option>
    <option>B</option>
    <option>C</option>
</select>
<select id="sel2">
    <option>A</option>
    <option>B</option>
    <option>C</option>
</select>
<select id="sel3">
    <option>A</option>
    <option>B</option>
    <option>C</option>
</select>
<script type="text/javascript">
    $(document).ready(function () {
        $("select").change(function () {
            var id = $(this).attr("id");
            alert (id);
        });
    });
</script>
 
Share this answer
 
var name=$.trim($("[id*='" + curid + "']").attr("name"));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900