Skip to main content

Posts

Showing posts with the label Jquery

Input Text Validation using BootStrap CSS and JQuery

HTML Code: <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery.min.js"></script> <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">   <meta charset="utf-8">   <title>Text Input Validation</title> </head> <body>   <strong>Enter any Data:<strong><br/> <input type="text" class="btn-lg btn-default" id="test"/>   <span id='testvalid'></span> </body> </html> JQuery Script Code $(document).ready(function(){       //Blur Event checks the input field when it loses focus      $('#test...

How to use Multi-Select Dropdown List in html select input using Jquery in JSP page with limited selections ?

Below Code Snippet shows Selecting Multiple Values $(document).ready(function() { $("#multiselect").dropdownchecklist( { onItemClick: function(checkbox, selector){ var justChecked = checkbox.prop("checked"); var checkCount = (justChecked) ? 1 : -1; for( i = 0; i 3 ) { alert( "Limit is 3 fruits to choose" ); throw "too many"; } },width: 250 }); });  Below code index.jsp page with jquery javascript, css, Ui, codes are imported Multiple Select Example Jquery Select Fruits Apple Mango Orange Strawberry Banana Output Page:

JSP and Servlet Form Submission without page refresh show results on the same page using Jquery AJAX

Code Snippet HTML Form  <form id='ajaxform' name='ajaxform' action='ajaxformexample' method='post'>  First Name: <input type='text' id='firstname' name='firstname' size='30' required/><br/>  Last Name: <input type='text' id='lastname' name='lastname' size='30'required/><br/>  Email:  <input type='email' id='emailid' name='emailid' size='30'required/><br/>  Password:  <input type='password' id='pwd' name='pwd' size='30'required/><br/>  <input type='Submit'/>   <div id='content'> </div> </form> the above HTML Form uses post method and url servlet redirect to " ajaxformexample " Javascript Code  var form = $('#ajaxform'); // id of form tag  form.submit(function () {  $.ajax({  ...