There are three way to change the URL for a Hyperlink using jQuery.
1- $(“a”).attr(“href”, “http://www.phpinterviewquestion.com/”); 2- $(“a[href='http://www.phpinterviewquestion.com/']“) .attr(‘href’, ‘http://phpinterviewquestion.com/’); 3- $(“a[href^='http://phpinterviewquestion.com']“).each(function() { this.href = this.href.replace(/^http:\/\/beta\.phpinterviewquestion\.com/, “http://phpinterviewquestion.com”);
2 Comments
Here is the example of toggled element using the :visible or :hidden selectors.
var vis = $(’#formdiv’).is(’:visible’); var hide= $(’#formdiv’).is(’:hidden’); $(document).ready(function(){
$(“table tr:eq(3)).css(“background”,”#000″); }) ; $(‘li:nth-child(1)’) selects the first while $(‘li:eq(1)’) selects the second. Because jQuery’s implementation of :nth-child(n) is strictly derived from the CSS specification, the value of n is “1-indexed”, meaning that the counting starts at 1. For all other selector expressions, however, jQuery follows JavaScript’s “0-indexed” counting. Given the following HTML:
<html>…<body><div ”one”><div ”two”><p><span>Some text</span></p></div></div></body></html> $(‘span’).parent() will select the <p> tag such that the element set in the jQuery object is [span]. $(‘span’).parents() will select all parent tags such that the element set in the jQuery object is [p, div.two, div.one, body, html]. So parent() will select the first parent element while parents() will select all elements straight up the DOM tree. Now jQuery has some great flexibility in that you could do that following: $(‘span’).parents().filter(‘div’) which would result in [div.two, div.one]. jQuery makes it even easier as the parent() and parents() methods support filtering built in so the above can be reduced to: $(‘span’).parents(‘div’) giving you [div.two, div.one]. Let’s continue with one more example, let’s say that you only need the first div in the parent DOM tree, jQuery to the rescue $(‘span’).parents(‘div:eq(0)’) will give you [div.two] A class is a blueprint of an object, which is an instance of a class.
PHP has 2 special data types that don't fall into the other categories:
Scalar data is data that only contains a single value. As of version 6, PHP features 6 scalar data types
Compound data can contain multiple values. PHP has 2 compound data types:
<?php
// Date Validation YYYY-MM-DD $date = '2012-03/13'; if(preg_match("/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/", $date) === 0) { echo 'Date must be in : YYYY-MM-DD'; } else { echo "Date Correct"; } ?> |