Monday 31 March 2014

JQuery Check element is block or hidden.

Introduction:

Here I will explain how to check any element like div,p,input is block or hidden.

In JQuery we can show/hide element by show(), hide() functions but how would we test element is visible or not so here is solution for check visibility of element.

Just need to check visible property.

Code:
$(element).is(":visible");


Example:





Suppose you want to check visibility of div element then just select div.

var b = $('div.test').is(":visible");;
alert(b);


This will alert true if div with class test is visible and return false if div with class test is hidden.



JavaScript get query string values

Introduction:

Here I will explain how to get Query String value from URL in JavaScript.

Code:
function getParameterByName(name) {
 name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
 var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
 results = regex.exec(location.search);
 return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}


Example:





Suppose you have three Query String in current URL a b and c and you need value of b so just need to pass b in this function.

var b = getParameterByName('b');
alert(b);

This will alert value of b.



Monday 24 March 2014

Change Default Port Number in Visual Studio 2012

Step 1
Right Click on the web site or project node in Solution Explorer.

Step 2
Select properties from options.



Step 3
Choose Web option.

Step 4
Choose Use Visual Studio Development Server Radio button.

Step 5
And Then Choose Specific Port, Now a Text Box is enable and you can set port number to whatever you need.