$.get('programs/programs.html', function(data) {
$(target).html(data);
here.append(data);
});
$.get('programs/programs.html', function(data) {
here.append($(data).find(target));
});
// jQuery
$("#element").css("width", "");
// Native
document.querySelector("#element").style.width = "";
{Order: this.cells[2].textContent}
$(function() {
(function() {/* module1 */})();
(function() {/* module2 */})();
(function() {/* module3 */})();
});
$(function() {/* module1 */});
$(function() {/* module2 */});
$(function() {/* module3 */});
function replaceChars(string, from, to) {
if (string[from] != undefined && string[to] != undefined) {
var newString = Array.prototype.slice.call(string);
newString[from] = string[to];
newString[to] = string[from];
return newString.join("");
} else {
return string;
}
}
replaceChars("qwerty", 2, 4); // "qwtrey"
var fields = [];
$(".fields .services").each(function() {
fields.push($("select option:selected", this).text() + ";" + $(".sum-input", this).val());
});
console.log(fields);
var fields = $(".fields .services").map(function() {
return $("select option:selected", this).text() + ";" + $(".sum-input", this).val();
});
fields = $.makeArray(fields);
console.log(fields);
var pauseButton = document.querySelector(".pause-button"),
start = Date.now(),
duration = 3000,
timePassed,
paused;
var timer = setInterval(change, duration);
pauseButton.addEventListener("click", function() {
if (!paused) {
clearInterval(timer);
timePassed = Date.now() - start;
paused = true;
} else {
setTimeout(function() {
timer = setInterval(change, duration);
}, duration - timePassed);
paused = false;
}
}, false);
function change() {
// ...
}
function mergeCells(table) {
var head = table.rows[0],
body = table.rows[1],
resultHead = "",
resultBody = "",
matches = {};
for (var i = 0; i < body.cells.length; i++) {
var headCellText = head.cells[i].textContent,
bodyCellText = body.cells[i].textContent,
match = matches[bodyCellText] || (matches[bodyCellText] = []);
match.push(headCellText);
}
for (var key in matches) {
var match = matches[key],
from = match[0],
to = match[match.length - 1];
if (match.length > 1) {
resultHead += "<td>" + from + "-" + to + "</td>";
} else {
resultHead += "<td>" + from + "</td>";
}
resultBody += "<td>" + key + "</td>";
}
head.innerHTML = resultHead;
body.innerHTML = resultBody;
}