HD..
HD..

Reputation: 1476

can we add textbox and button to select 2

here i attached the code of select can we add the textbox and button into select2 elements. here which i used a code:

<select style="width:100%"  id="e9">

    <option value="volvo">Suger</option>
    <option value="saab">Saab</option>
    <option value="opel">Opel</option>
    <option value="audi">Audi</option>

</select>

here i attached the output image how i really want: text box with button in select 2

Upvotes: 1

Views: 4434

Answers (2)

vipin
vipin

Reputation: 678

$("#e9").select2("container").find("div.select2-drop").append('<div><input type="text" name="lname"><input class="PrimaryBtn" type="submit" value="Add"></div>');

may be this will help, it will add to the needed select2 only

Upvotes: 0

HD..
HD..

Reputation: 1476

here is the answer...

 $(".select2-drop").append('<div><input type="text" style="width: 86%;padding: 9px;"name="lname"><input class="PrimaryBtn" type="submit" value="Add"></div>');

Upvotes: 3

Related Questions