开发者

How to turn off different items in a select box through jQuery?

Working with Wordpress (contact-form plugin by iDeasilo ) and needed help performing a certain task. I've searched Google, but was unable to find what I开发者_如何学编程 was looking for. New to working with jQuery, so any help will help.

My question is:

How would I be able to hide or not allow a user from selecting other option in a select box, if he/she clicks on a specific radio button?

So if there is three different radio buttons (sandwich, taco and pizza), and I was to click on "pizza". The select box option should stay just at it's default. When I click the select box, all other options should disappear or be disabled so you can't choose from the list. But this should only happen when you click on "pizza".

How would I accomplish this?


I would attach an event handler to the one control (radio button), which affects/changes the options in the select control:

$('#myRadioButtonInput').click(function() { $('#theSelectToAffect option.Conditional').hide(); });

Just attach the 'Conditional' class to the conditional options when you make the drop down/select.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜