Thursday 9 October 2014

how to get the execution directory path in java


//how to get the execution directory path in java


package com.vipul.org;

public class GetRuningPath {

/**
* @param args
*/
public static void main(String[] args) {
String classpath = System.getProperty("user.dir");
System.out.println("" + classpath);
}

}

Sunday 5 October 2014

radio button validation in jquery

<input class="attrInputs" type="radio" name="chest" value="A">
<input class="attrInputs" type="radio" name="chest" value="B">
<input class="attrInputs" type="radio" name="chest" value="C">
   
    radio button validation in jquery


==============================

if($('input[name=chest]:checked').length<=0)
{
 alert("No radio checked")
}

=======================================================
demo

black color code in css font

Black font color in csss

use



 color :#000000

Wednesday 1 October 2014

jquery get value of input text field length

jquery get value of input text field length

Demo


jquery get value of input text field length

<input type="text" id="textbox"/>

<p>Error </p>
<button type="button" id="button">Click Me!</button>

============
$('#button').click(function() {
    var value = $('#textbox').val().length;
    
    if(value >=1)
    {
    alert(value);
         $("p").hide();
    }
    else{
    
        
    }
    
 
});
 



 

jquery show hide

jquery show hide

jquery show hide Demo

<input type="text" id="textbox"/>

<p>Error </p>
<button type="button" id="button">Click Me!</button>


$('#button').click(function() {
    var value = $('#textbox').val().length;
   
    if(value >=1)
    {
    alert(value);
         $("p").hide();
    }
    else{
    $("p").show();
       
    }
   

});








get input button value jquery

get input button value jquery

<input type="text" id="textbox"/>


<button type="button" id="button">Click Me!</button>


===============================================================
$('#button').click(function() {
   
    alert($('#textbox').val());
});

==============================================================
Please find Demo here

jquery call function on button click

jquery call function on button click

<button type="button" id="button">Click Me!</button>


$(function(){
    $('#button').click(function() {
        alert("Hello");
    });
});

Demo http://jsfiddle.net/vipulg/gm68jxas/2/

jquery keydown keypress event listner

change background color on keydown and keyup.


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>

</script>
</head>
<body>

Enter your name: <input type="text">
<p>Enter your name in the input field above. It will change background color on keydown and keyup.</p>


==================
Jquery
==================
$(document).ready(function(){
  $("input").keydown(function(){
    $("input").css("background-color","yellow");
  });
  $("input").keyup(function(){
    $("input").css("background-color","pink");
  });
});
=====================================================
+++++++++++++++++++++++++++++++++++++++++++++++++++++

check input field length in jquery?

check input field length in jquery?

check input field length in jquery?
click on this
<a href="test">test</a>

<div id="selector"></div>
<input type="text" id="textbox"/>

<div id="selectorSize"></div>
<div id="name"></div>

==================================
JQuery script is
==================================
jQuery(function () {
    $('a').click(function (e) {
        e.preventDefault();
        var name = $(this).text();
        var myLength = $("#textbox").val();
        $("#selectorSize").text(myLength.length);
       
        if (myLength.length <= 6) {
              $("#name").text("ERR");
             $("#name").addClass("error");
         }
       
        $("#selector").text(name);
        $("#textbox").val(name);
    });
});
============================================

View Demo Here