• 0

HTML - is there a 'maxlength' for select boxes?


Question

as the topic states, is there a way to limit the length of a select box the same way you can limit the length of an input box either thru css or javascript?

i'm trying to make a <select> tag "fit" inside a table cell but one of the values in the select box is too and it ends up stretching out the width of the cell. i came by this:

http://www.devguru.com/Features/tutorials/...mbocontrol.html

but it uses vb script and i want something to be compatible across a variety of platforms. can someone help me out?

thanks in advanced :)

5 answers to this question

Recommended Posts

  • 0

The link, after a quick scan, replaces the code for a standard drop down, with various form elements, divs and images. I have worked on something like this myself using a combination of html, css and javascript, but its still a work in progress.

The objective of this link seems to be to overcome the styling limitations of a combobox, i.e. comboboxes inherit most of their appearence from the operating system, and always have the highest z-index(s) on the page, so any floating divs used will appear below a combobox, regardless of any positioning you set.

I think all you are looking for is:

Using the style attribute of the <select> tag, set "width:[desired width];" if you want the select box to inherit the entire width of the cell you might try style="width:100%;" in the <select> tag.

  • 0
  OSUKid7 said:
Yes, this?

&lt;input type="text" maxlength="14" /&gt;

585871032[/snapback]

hehee that's the first thing i tried and it doesn't work. but thanks for the reply :)

  )-(orus said:
Using the style attribute of the <select> tag, set "width:[desired width];"  if you want the select box to inherit the entire width of the cell you might try style="width:100%;" in the <select> tag.

585871054[/snapback]

thank you sir! that did the trick :D

this thread can now be locked/closed/deleted

  • 0
  Rail Grinder said:
this thread can now be locked/closed/deleted

585873837[/snapback]

ok so i've got another question ... i found some css styles that can be used with the <style> tag and i tried using the word-wrap style as stated here:

http://msdn.microsoft.com/library/default....ects/select.asp

needless to say it doesn't wrap. anyone got any suggestions? sorry for these n00bish questions. i used the following code in my <style> tag within my <header> tags:

&lt;style&gt;
select {word-wrap : break-word}
&lt;/style&gt;

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • A summary of the article shouldn't be an issue in theory, as the information is all based within the document itself. The problem with a lot of AI models is that they are trained off both Wikipedia as a primary source and other secondary websites which have less reliable information. As an encyclopaedia it is no doubt going to have bias in one way or another, all encyclopaedias do. The difference is that there is a process for a lot of this information to be figured out whether or not it is an opinion, or the source of that information, and to be aware of the possible bias in the first place, even your own bias as a reader. The way many people understand languages these days is quite limited, particularly in certain areas of the world. This is obvious in many types of "journalism" where some articles are thinly disguised opinion pieces, Where language is carefully curated to push a point of view despite it looking like fact. This is partly why a lot of the Western world is now so divided.
    • I paid for a year subscription, starting in December, I think. I like the user-friendliness and assets like royalty-free music and sounds. But they need to fix some of the horrific bugs before they start adding more features. For starters, you should be able to drag stuff around the timeline without it completely obliterating transitions, synchronization timing, and clip lengths. If you already set up footage and audio how you want, and try to insert more by sliding content to the right, you'll have to clean it all up again. The scroll wheel constantly stops working, and you have to minimize the window and restore it to get it back. When selecting text at the top right in special text tools, it glitches and goes to "copy" mode with a weird pop-up on top of your cursor and you can't type. These are more important than AI tools and new features. Microsoft, start by making your product less painful to use.
    • 🙄 Whats the need to launder? Do you have any reputable sources?
    • Thanks, I'll download it and see how it goes. Gonna be tough. I've used Nova Launcher for around 10+ years I think.
    • Wikipedia has become hot molasses with mostly filth masquerading as truth. Most of it is the imagination of few writers who think of themselves as above god. The narrative setup is mind boggling.
  • Recent Achievements

    • Apprentice
      Adrian Williams went up a rank
      Apprentice
    • Reacting Well
      BashOrgRu earned a badge
      Reacting Well
    • Collaborator
      CHUNWEI earned a badge
      Collaborator
    • Apprentice
      Cole Multipass went up a rank
      Apprentice
    • Posting Machine
      David Uzondu earned a badge
      Posting Machine
  • Popular Contributors

    1. 1
      +primortal
      515
    2. 2
      ATLien_0
      258
    3. 3
      +Edouard
      191
    4. 4
      +FloatingFatMan
      174
    5. 5
      snowy owl
      133
  • Tell a friend

    Love Neowin? Tell a friend!