Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
570 views
in Technique[技术] by (71.8m points)

php - Display checkbox after select combo box

I need some idea here.. i wanted to make search function using combo box. after user has selected certain value from the combo box...based on selected value checkbox will appears...

example ...

[combo box] -> select 1.user 2.item 3.tag

when user select "user"

checkbox as follow will appears

checkbox- update user checkbox-delete user

and so forth... this to filter more.. and make user easy to find/view what they want from their search...

if you have other idea..instead of using combo box and check box.. please let me know..

thankssssssss :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Give your select list an ID.

Using jQuery:

$(document).ready(function(){
  $("#mySelect").change(function(){
    var selectValue = $("#mySelect").val();
    switch(selectValue){
      case "someValue":
        var checkbox = '<input type="checkbox" name="something" value="something" />'
        $("#someDiv").append(checkbox);
        break;
      case "someOtherValue":
        var checkbox = '<input type="checkbox" name="something" value="something" />'
        $("#someDiv").append(checkbox);
        break;
    }
  });
});

And so on. Hopefully, you get the idea.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...