Category Archives: JQuery

SCROLL TO BOTTOM ON BUTTON CLICK

HTML —- LT div id=”main” GT LT div class=”container-fluid” id=”subParentDiv” GT LT /div GT LT /div GT JAVA SCRIPT ———– function checkScroll(){ scroll_to($(“#main”), $(“#subParentDiv”)); } function scroll_to(base, target){ base.animate( { scrollTop:target.height() },1000 ); } EXPLANATION ———– Call the checkScroll() function … Continue reading

Posted in JavaScript / CSS, JQuery | Leave a comment

Copy Particular Row and Append it in a Table

function copyAndAppend(id){ $(“#”+id+” tr:last”).after(“ ” + $(“#serviceRow”).html() + “ “); } Explanation: 1) $(“#serviceRow”).html() : I will copy all the inner content of an element having id = “serviceRow” 2) $(“#”+id+” tr:last”) : I have used ‘id’ variable, its value … Continue reading

Posted in JavaScript / CSS, JQuery | Leave a comment

JQUERY VALIDATION FIRST FLIGHT JSP

MyForm <script src="/jquery/jquery-1.9.1.js”> <script src="/jquery/jquery.validate.min.js”> /* example styles for validation form demo */ #registrationForm label.error { color: red; display: inline-block; padding: 0; text-align: left; } .fieldlabel{ width:150px; text-align: right; } (function($,W,D) { var JQUERY4U = {}; JQUERY4U.UTIL = { setupFormValidation: … Continue reading

Posted in JQuery | Leave a comment

CHANGE IMAGE SRC VALUE ON ITS CLICK EVENT

JAVA SCRIPT CODE ================  function changeImageSrc(thisElement){ var newSrc ; if($(thisElement).attr(“src”).indexOf(“showme.png”)!=-1){ newSrc = $(thisElement).attr(“src”).replace(“showme.png”, “hideme.png”); }else{ newSrc = $(thisElement).attr(“src”).replace(“hideme.png”, “showme.png”); } $(thisElement).attr(“src”, newSrc); } HTML CODE =========== <img src=”<%=basePath%>/images/showme.png” alt=”Edit” border=”0″ id=”showLogMonitors” value=”Show Monitors” onclick=”showHideLogMonitorList(this);” />

Posted in JavaScript / CSS, JQuery | Leave a comment

Water Mark java script function for username/password

function watermark(inputId,text){ var inputBox = document.getElementById(inputId); document.getElementById(inputId).style.color=”black”; if (inputBox.value.length > 0){ if (inputBox.value == ‘UserName’){ inputBox.value = ”; } if (inputBox.value == ‘Password’){ inputBox.value = ”; inputBox.type = “password”; } if (inputBox.value == ‘Security Code’){ inputBox.value = ”; } } … Continue reading

Posted in JavaScript / CSS, JQuery | Leave a comment

JAVA SCRIPT TO HAVE ONLY ONE SPACE BETWEEN WORDS

function removeExtraSpaces(){                     var searchName = document.getElementById(“name”).value;                      searchName = searchName.trim();                      var words … Continue reading

Posted in JavaScript / CSS, JQuery | Leave a comment

JQUERY to get values of all text field with same name or id

$(“input[name=hobby]”).each(function() {         if($(this).val().trim().length<1){                alert(“Emptry value”);         } });

Posted in JQuery | Leave a comment