There are two questions:
It turns out that it is valid HTML (see. And <input> is well-formed without <form>? ), So you are on the safe side here.
- Will all common browsers be accepted?
After googling around, I did not see any information about the problems with this use of input tags. This suggests that all common browsers accept this valid HTML (as they should). When developing any website accessible to the general public, I always did a manual cross-browser check to find any deviations that some browsers might use with my website.
The problem is that you most likely will not be able to tell, looking at your server logs, whether some browsers have problems with your HTML. It may simply not work on IE 6, and you can never find if a dissatisfied client does not call and notify you.
If this is a public website, get some statistics on the most commonly used browsers, decide which ones you want to support, and make sure that the website behaves correctly in these browsers. Itโs a pain in the ass, but I donโt know how to get around this. Browsers may not respond correctly to correct HTML.
As a rule, Firefox, Chrome and Safari do not behave very well, and due to automatic updates, most people will have the very latest version. If the latest version of the browser is working, I wonโt worry too much that users with an older version will have problems.
The real test is always Internet Explorer. Although versions 8 and 9 are standards compliant, IE 7 certainly needs to be verified. IE 6 is the worst offender for unusual behavior. It was introduced in 2002, but today it is used by 6% of the population! In most cases, this is due to hacked copies of Windows XP in China, but it is also used quite a lot in corporate networks, where OS and browsers are centrally deployed, and administrators have not been able to advance since the beginning of 2000.
In conclusion: your code is unusual, but ok, check it out manually in the browsers you expect.