开发者

JQuery combo box and JSP

开发者 https://www.devze.com 2023-01-27 11:23 出处:网络
I am trying to use this plugin from JQuery, however how do I populate th开发者_C百科e options of the selection of the combo box? I am pretty new to JQuery so some help would be appreciated

I am trying to use this plugin from JQuery, however how do I populate th开发者_C百科e options of the selection of the combo box? I am pretty new to JQuery so some help would be appreciated

So say I have a html code as follows:

<select name = "test">
   <option>1</option>
<option>2</option>
</select>

what should I do to make it so I have the interface above?


Checkout the example on this page.

You still create an html select element with child options. Then you turn it into a jquery combobox with either a really simple $('#comboboxid').combobox(). If you want, I can help you with the more advanced options.


This jQuery plugin only enhances the look'n'feel of a HTML <select> element with customizeable CSS styles. It doesn't require any changes to standard HTML/JSP/whatever code you're using to populate the options. You can just write down the dropdown options the usual way in JSP as you would do without this jQuery plugin.

By the way, that plugin is pretty old and its name is fairly misleading. A combobox is in essence an editable dropdown. But this plugin does nothing about that at all. What's actually your functional requirement? Aren't you looking at the wrong plugin?


Update: as to how to use it, just include the required JS files in <head> and call $(selector).combobox() during document load. There's even a complete example here (note that you need to click the "click to view/hide" link to see the HTML).

0

精彩评论

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