Skip to main content

Validate field, select or checkbox without form tag



Good day,





I found a lot of topics about that, but, without a proper answer.





Many of topics ended with question why you just can't add form?





I'm working on a project that based on ASP.NET and I have one form tag, one form tag that contains all the html code inside it.





I can't use any ASP.NET controls and must done validation by front-end (jQuery).





Everything is fine when there is only one form and one submit button, then I can use simple query validation plugin, but it gets complicated when I have more than one form and of course more than one submit button.





Any suggestion, ideas or real example how to do that?





Maybe I can somehow put every field and submit button inside a div and validate them by submit within that div?





Thank you!


Comments

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...