$('select[@name=mySelect]').attr('size', $('select[@name=mySelect] option').size());
$('select[@name=mySelect] option:contains('текст нужного элемента')').attr('disabled', 'disabled');
alert( $('select[@name=mySelect] option:selected').val() );
if( typeof $('select[@name=mySelect] option:selected').text() === 'undefined' ){
alert('Ни один элемент списка не выбран');
}
$('select[@name=mySelect] option:first').removeAttr('selected');
$('select[@name=mySelect] option:first').attr('selected', 'yes');
$('select[@name=mySelect]').append('');
$('select[@name=mySelect] option').remove();
// или
$('#id option').remove();
$('#someinput').bind('keyup change keydown', function() {
alert ("one of three events is called!");
});
if (!$('.check_one:checked').length){
alert(message);
}
$("#mySelect option[value='3']").attr('selected', 'selected');
$('element').size();
jQuery.preloadImages = function()
{
for(var i = 0; i < arguments.length; i++)
{
jQuery("
").attr("src", arguments[i]);
}
};
// Использование
$.preloadImages("image1.gif", "/path/to/image2.png", "some/image3.jpg");
//A. Цель Safari
if( $.browser.safari ) $("#menu li a").css("padding", "1em 1.2em" );
//B. Цель все выше IE6
if ($.browser.msie && $.browser.version > 6 ) $("#menu li a").css("padding", "1em 1.8em" );
//C. Цель IE6 и ниже
if ($.browser.msie && $.browser.version <= 6 ) $("#menu li a").css("padding", "1em 1.8em" );
//D. Цель Firefox 2 и выше
if ($.browser.mozilla && $.browser.version >= "1.8" ) $("#menu li a").css("padding", "1em 1.8em" );
var el = $('#id');
el.html(el.html().replace(/word/ig, ""));
function equalHeight(group) {
tallest = 0;
group.each(function() {
thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}
/*
Использование:
$(document).ready(function() {
equalHeight($(".recent-article"));
equalHeight($(".footer-col"));
});
*/
$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});
$(document).ready(function(){
// Сбрасываем размер шрифта
var originalFontSize = $('html').css('font-size');
$(".resetFont").click(function(){
$('html').css('font-size', originalFontSize);
});
// Увеличиваем размер шрифта
$(".increaseFont").click(function(){
var currentFontSize = $('html').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*1.2;
$('html').css('font-size', newFontSize);
return false;
});
// Уменьшаем размер шрифта
$(".decreaseFont").click(function(){
var currentFontSize = $('html').css('font-size');
var currentFontSizeNum = parseFloat(currentFontSize, 10);
var newFontSize = currentFontSizeNum*0.8;
$('html').css('font-size', newFontSize);
return false;
});
});
$('a[rel$="external"]').click(function(){
this.target = "_blank";
});
/*
Использование:
enkidu.ru
*/
$(document).ready(function()
{
$("#switcherButton").click(function()
{
if( $('#toogleDiv').hasClass("open") )
{
$("#toogleDiv").height($("#toogleDiv").height())
$("#toogleDiv > *").fadeOut();
$("#toogleDiv").removeClass("open").slideUp("slow", function(){
$("#switcherButton").val("down");
});
}
else
{
$("#toogleDiv > *").css("display", "block");
$("#toogleDiv").addClass("open").slideDown("slow", function(){
$("#switcherButton").val("up");
});
}
});
});
$(document).ready(function()
{
$("#show").click(function () {
$("div#showDiv").show("slide", {}, 1000);
});
});
Показать эффект
$(document).ready(function()
{
$("#div112").click(function () {
$(this).hide("slide", {}, 1000, function(){$(this).show()});
});
});
$(document).ready(function()
{
$("#div10").click(function () {
$(this).hide("blind", {direction:"vertical"}, 1000);
});
$("#div11").click(function () {
$(this).hide("blind", {direction:"horizontal"}, 1000);
});
});
$(document).ready(function()
{
$("#div124").click(function () {
$(this).hide("clip", {direction:"vertical"}, 1000);
});
$("#div242").click(function () {
$(this).hide("clip", {direction:"horizontal"}, 1000);
});
});
$(document).ready(function()
{
$("#div771").click(function () {
$(this).hide("puff", {}, 1000);
});
$("#div2ee").click(function () {
$(this).hide("puff", { percent: 700 }, 1000);
});
});
$(document).ready(function()
{
$("#div240w").click(function () {
$(this).hide("scale", {}, 1000);
});
$("#div1242w").click(function () {
$(this).effect("scale", { percent: 0 }, 1000);
});
$("#div262").click(function () {
$(this).effect("scale", {
percent:200,
direction:'horizontal'}, 1000);
});
});
$(document).ready(function()
{
$("#divr41").click(function () {
$(this).hide("fold", {}, 1000);
});
$("#div2ye5").click(function () {
$(this).hide("fold", { size: 50 }, 1000);
});
});
$(document).ready(function()
{
$("#div1w3").click(function () {
$(this).hide("drop", { direction: "left" }, 1000, function(){$(this).show()});
});
$("#div2wf").click(function () {
$(this).hide("drop", { direction: "down" }, 1000, function(){$(this).show()});
});
$("#divq2wf").click(function () {
$(this).hide("drop", { direction: "up" }, 1000, function(){$(this).show()});
});
$("#divq7wf").click(function () {
$(this).hide("drop", { direction: "right" }, 1000, function(){$(this).show()});
});
});
$(document).ready(function()
{
$("#toggle").click(function () {
$("div#toggleDiv").toggle("slide", {}, 1000);
});
});
Показать эффект
$(document).ready(function()
{
$("#div1er65").click(function () {
$(this).effect("pulsate", { times: 2 }, 1000);
});
$("#divr2rw").click(function () {
$(this).effect("pulsate", { times: 9 }, 50);
});
});
$(document).ready(function()
{
$("#explodeDiv").click(function () {
$(this).effect("explode", {}, 1000);
});
$("#divwww2").click(function () {
$(this).hide("explode", { pieces: 25 }, 1000);
});
});
$(document).ready(function()
{
$("#div1").click(function () {
$(this).effect("bounce", { times: 3 }, 300);
});
$("#div2").click(function () {
$(this).effect("bounce", { times: 7,
direction: 'right',
distance: 50 }, 300);
});
});
$(document).ready(function()
{
$("#div3").click(function () {
$(this).effect("highlight", {}, 1000);
});
$("#div4").click(function () {
$(this).effect("highlight", {color: '#ff0000'}, 500);
});
});
$(document).ready(function()
{
$("#div5").click(function () {
$(this).effect("shake", { times: 3 }, 300);
});
$("#div6").click(function () {
$(this).effect("shake", {
times: 4,
direction: 'down',
distance: 10
}, 300);
});
});
$(document).ready(function()
{
$("#div7").click(function () {
$(this).effect("transfer", { to: "div#div8" }, 2000);
});
$("#div9").click(function () {
$(this).effect("transfer", { className: "transfer2",
to: "div#div8" }, 800);
});
});