-
Alphanumeric, Dash and Underscore Javascript Validation using Regular Expression
Saturday, 3 May 2014
var regexp = /^[a-zA-Z0-9-_]+$/;var check = "checkme";if (check.search(regexp) == -1){ alert('invalid'); }else{ alert('valid'); }var regexp = /^[a-zA-Z0-9]+$/;var check = "checkme";if (check.search(regexp) == -1){ alert('invalid'); }else{ alert('valid'); }Posted by Unknown at 05:05 | Labels: jquery, Js | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Jquery get key press button event
Friday, 25 April 2014
<input type="text" name="txt1" onKeyPress="SearchName(event)" value="<Type To Search>" >
function SearchName(e, txtObj, selObj) {
evt = e || window.event;
var keyPressed = evt.which || evt.keyCode;
}Posted by Unknown at 05:49 | Labels: jquery, Js | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Upload file via ajax jquery php
Monday, 14 April 2014
$.ajax({
type : "POST",
/* data : $('#reg-restaurant-form').serialize(),*/
contentType: false,
processData: false,
data :new FormData($('#reg-restaurant-form')[0]),
url : myBaseUrl+('/UsersActions/restaurantUserAdd'),
success : function(opt){
}
});
Posted by Unknown at 00:32 | Labels: ajax, jquery, Js, php | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
To display title in input field
Friday, 3 May 2013
<!-- Script - Title display for input text box-->
<script type="text/javascript" language="javascript"> // <![CDATA[
$(document).ready(function() {
$('input[type="text"]').focus(function(srcc)
{ ($(this).val() == $(this)[0].title)
{ $(this).removeClass("defaultTextActive");
$(this).val("");
} });
$('input[type="text"]').blur(function()
{ if ($(this).val() == "")
{ $(this).addClass("defaultTextActive");
$(this).val($(this)[0].title); }
}); $('input[type="text"]').blur(); });
// ]]>
</script>
Posted by Unknown at 18:41 | Labels: html, Js | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Javascript to know
Sunday, 7 April 2013
How can we submit from without a submit button?
We can use a simple JavaScript code linked to an event trigger of any form field. In the JavaScript code, we can call the document.form.submit(); function to submit the form.
Posted by Unknown at 06:13 | Labels: Interview, Js | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Assigning php array to javascript
Thursday, 21 March 2013
<?php
$phpArray = array("hi" => "hello"); ?> <script>
var jsArray = <?php echo json_encode($phpArray); ?>;
alert(jsArray.hi);
</script>
// use jsArray.hi or jsArray[hi]
Refer: http://sandbox.phpcode.eu/g/9e705
Refresh it to get resultPosted by Unknown at 20:48 | Labels: Js, php | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Website design tool and links
Monday, 21 January 2013
http://twitter.github.com/bootstrap/
http://www.webdesignerdepot.com/category/code/
Collection of HTML, CSS and JQUERY
http://jqueryexample.com/
http://www.htmldrive.net
http://www.dynamicdrive.com/
http://jqueryui.com/
http://www.jacklmoore.com
http://webdesignledger.com/tools/10-jquery-plugins-that-will-make-your-life-easier
Posted by Unknown at 22:32 | Labels: html, jquery, Js, websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Jquery Prompt box
Thursday, 20 December 2012
Jquery Prompt box
http://trentrichardson.com/Impromptu/Posted by Unknown at 05:09 | Labels: jquery, Js, websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Websites to learn!!
Tuesday, 30 October 2012
http://www.javascriptkit.com/
http://ntt.cc/2008/05/10/over-10-useful-javascript-regular-expression-functions-to-improve-your-web-applications-efficiency.html
http://htmldog.com - html
http://freeajaxscripts.net - ajax
Javascript
Coundown timer
http://keith-wood.name/countdown.html
Jquery code
http://jsfiddle.net/tqyj4/4/Posted by Unknown at 07:45 | Labels: ajax, html, Js, websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Javascript to validate all form fields when onSubmit
function checkrefereremail(){
//var testresults
var nam=document.getElementById('name').value;
var mob=document.getElementById('contactno').value;
var str=document.getElementById('emailid').value;
var anum=/(^\d+$)|(^\d+\.\d+$)/ // integer validation
var flag=1;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i // email validation
$('#namemsg').html('');$('#mobmsg').html('');$('#emailmsg').html('');$('#captchamsg').html('');
if(nam == '')
{
document.getElementById("namemsg").innerHTML = "Please input a valid name!";
flag++;
}
if (anum.test(mob) == false)
{
document.getElementById("mobmsg").innerHTML = "Please input a valid mobile no!";
flag++;
}
if(filter.test(str) == false){
document.getElementById("emailmsg").innerHTML = "Please input a valid email address!";
flag++;
}else
{
return Captcharesult()
return true;
}
}
</script>
Refer mydala view source:
<script>
function user()
{
var isflag=1;
$('#emailidErr').html('');$('#cpasswordErr').html('');$('#passwordErr').html('');$('#mobilenoErr').html('');$('#dobErr').html('');$('#tcboxErr').html('');$('#captchaErr').html('');
if($('#emailid').val()=='')
{
$('#emailid').addClass("red-border");
$('#emailidErr').html('<p>Please Enter Email Id</p>');
isflag++;
}else{
var emailFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; // Both work same:and are userful /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
if(!(emailFilter.test($('#emailid').val())))
{
$('#emailid').addClass("red-border");
$('#emailid').val('');
$('#emailidErr').html('<p>Please Enter Valid Email Id</p>');
isflag++;
}
}
if($('#password').val()=='')
{
$('#password').addClass("red-border");
$('#passwordErr').html('<p>Please Enter Password</p>');
isflag++;
}else{
var Password = $('#password').val();
if(Password.length<6)
{
$('#passwordErr').html('<p>Please Enter Six digit in Password</p>');
$('#password').addClass("red-border");
isflag++;
}
if(Password!=$('#cpassword').val())
{
$('#cpassword').addClass("red-border");
$('#cpasswordErr').html('<p>Please Enter Same Password in Confirm Password</p>');
isflag++;
}
}
if($('#mobileno').val()!='' )
{
if(!($('#mobileno').val().match(/^[0-9]+$/)))
{
$('#mobileno').addClass("red-border");
$('#mobilenoErr').html('<p>Please Enter Numeric Value in Mobile Number!</p>');
isflag++;
}
var Mobile=$('#mobileno').val();
if ((Mobile.length<10))
{
$('#mobilenoErr').html('<p>Please Enter Ten digit in Mobile Number!</p>');
$('#mobileno').addClass("red-border");
isflag++;
}
if ((Mobile.length>10))
{
$('#mobilenoErr').html('<p>Please Enter Ten digit in Mobile Number!</p>');
$('#mobileno').addClass("red-border");
isflag++;
}
}
else
{
$('#mobileno').addClass("red-border");
$('#mobilenoErr').html('<p>Please Enter Your Mobile Number</p>');
isflag++;
}
if($('#cityid').val()=='')
{
$('#cityid').addClass("red-border");
$('#cityidErr').html('<p>Please Select City</p>');
isflag++;
}
if($('#date_dd').val()=="" && $('#date_mm').val()=="" && $('#date_yy').val()=="")
{
if($('#date_dd').val()==""){$('#date_dd').addClass("red-border");}
if($('#date_mm').val()==""){$('#date_mm').addClass("red-border");}
if($('#date_yy').val()==""){$('#date_yy').addClass("red-border");}
$('#dobErr').html('<p>Please Select Date of Birth!</p>');
isflag++;
}
if($('#b_pincode').val()!='' )
{
if(!($('#b_pincode').val().match(/^[0-9]+$/)))
{
$('#b_pincode').addClass("red-border");
$('#b_pincodeErr').html('<p>Please Enter Numeric Value in Zip Code!</p>');
isflag++;
}
var zipcode=$('#b_pincode').val();
if ((zipcode.length<6))
{
$('#b_pincodeErr').html('<p>Please Enter six digit in Zip Code!</p>');
$('#b_pincode').addClass("red-border");
isflag++;
}
if ((zipcode.length>6))
{
$('#b_pincodeErr').html('<p>Please Enter six digit in Zip Code!</p>');
$('#b_pincode').addClass("red-border");
isflag++;
}
}
if($('#captcha').val()==''){
$('#captcha').addClass("red-border");
$('#captchaErr').html('<p>Please Enter Verification code</p>');
isflag++;
}
if(document.form_user.tcbox.checked == false)
{
$('#tcbox').addClass("red-border");
$('#tcboxErr').html('<p>Please accept the T&C.</p>');
isflag++;
}
if(isflag > 1){
$('#loginerror').show();
return false;
}
document.getElementById('form_user').submit();
document.form_user.submit();
}
</script>Posted by Unknown at 04:22 | Labels: Js | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
if (!document.feedback.field.checked) {
// box is not checked
return false;
}Posted by Unknown at 03:54 | Labels: Js | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Javasript email validation!!
Monday, 29 October 2012
<script>
function checkemail(){
//var testresults
var str=document.getElementById('emailsub').value;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
{
//testresults=true
return newsletter() // this to call another javascript function
return true;
}
else{
alert("Please input a valid email address!")
//testresults=false
return false;
}
//return (testresults)
}
</script>
Refer : http://www.javascriptkit.com/script/script2/acheck.shtml
Posted by Unknown at 04:40 | Labels: Js | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Page reload using onclick event
Sunday, 14 October 2012
Onclick page reload using js
onclick="document.location.reload(true)"Posted by Unknown at 23:09 | Labels: cakephp, html, Js, php | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Java script to reload a page in Html and Cakephp
Thursday, 11 October 2012
Java script to reload a page in Html and Cakephp
onclick="document.location.reload(true)"JS onclick event in html<a href="#" onclick="document.location.reload(true)"></a>Js onClick event in cakephp<?php echo $this->Html->image('image.png',array('onClick' => "document.location.reload(true)"),array('escape' => false)); ?>
Reload function in javascript
location.reload();
window.setTimeout('location.reload()', 3000);
Posted by Unknown at 01:58 | Labels: Js | 1 comments | Email This BlogThis! Share to X Share to Facebook |