Tag Archives: how to
How to select all anchors with display block jquery
How to select all anchors with display block jquery Very often or not, you need to select all the elements from within the DOM, that have their display property set to “block”. Solution
1 2 3 |
$('a').filter(function (index) { return $(this).css("display") === "block"; }) |
Filter function from jQuery to the rescue. Description: Reduce the set of matched elements to those that match the selector or pass
How to redirect URL in Javascript or jQuery
How to redirect URL in Javascript or jQuery I will present some ways to redirect the user to another page from the client side using only plain javascript. 1) Using window.location.href you obtain a similar behavior as an HTTP redirect
1 2 3 |
<script language=”JavaScript”> window.location.href = 'http://www.google.com'; </script> |
2) Using window.location.replace
1 2 3 |
<script language=”javascript” type=”text/javascript”> window.location.replace("http://anothersite.com"); </script> |
window.location.href VS window.location.replace It is better than using window.location.href, because replace() does not put