[Solved] Does not work java script for more than one element


firstly I found java script Part with id = “demo-select2-1” in theme’s scripts then I redefine same function with New Name and use new id in other DropDownListFor:

@Html.DropDownListFor(model => model.MemberInstance.MemberType_Id, new SelectList(Model.MemberTypeList, "Id", "Title"), new { @id = "demo-select2-1", @class = "form-control" })
@Html.DropDownListFor(model => model.SurgeryInstance.SurgeryType_Id, new SelectList(Model.SurgeryTypeList, "Id", "SurgeryTitle"), new { @id = "demo-select2-a", @class = "form-control" })

and also java script function is

function r() {
    var b = a("#demo-select2-1");
    b.select2({
        dir: "rtl"
    })
}

and my new function is

function r1() {
    var b = a("#demo-select2-a");
    b.select2({
        dir: "rtl"
    })
}

also I can use it for multiple elements with same way

solved Does not work java script for more than one element