alexa-tracking

Script JQUERY Yang Paling Sering Digunakan Di Website

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/54196ebc582b2e17148b4577/script-jquery-yang-paling-sering-digunakan-di-website
Script JQUERY Yang Paling Sering Digunakan Di Website
Salam Kenal Mas emoticon-Salaman Saya Member Baru Disini Mas emoticon-Baby Girl
Oke Langsung Saja Ke Tujuan Utama TS "Script JQUERY Yang Paling Sering Digunakan Di Website"

1. Script JQuery Selector Umum Digunakan

//--- COMMON JQUERY SELECTORS ---//
// get element by id
$("#ElementID").whatever();
// get element by css class
$(".ClassName").whatever();

// get elements where id contains a string
$("[id*='value']").whatever();

// get elements where id starts with a string
$("[id^='value']").whatever();

// get elements where id ends with a string
$("[id$='value']").whatever();

// get all elements of certain type (can use "p", "a", "div" - any html tag)
$("div").whatever();

2. Script JQuery Tambah dan Hapus Class CSS

//--- ADD & REMOVE CSS CLASSES ---///
// add css class
$("#DivID").addClass("newclassname");

// remove css class
$("#DivID").removeClass("classname");

// add & remove class together
$("#DivID").removeClass("classname").addClass("newclassname");

// add & remove multiple classes
$("#DivID").removeClass("classname classname2").addClass("newclassname newclassname2");

3. Script JQUERY Merubah dan Mendapatkan Nilai HTML Textbox

//--- GET & SET TEXTBOX VALUE ---//
//--- CAN ALSO BE USED ON ANY OTHER ELEMENT THAT HAS A VALUE PROPERTY ---//
// get the value of a textbox
var TextboxValue = $("#TextboxID").val();

// set the value of a textbox
$("#TextboxID").val("New Textbox Value Here");

4. Script JQuery Mendapatkan dan Merubah Elemen HTML

//--- GET & SET HTML OF ELEMENT ---//
// get element html
var DivHTML = $("#DivID").html();

// set element html
$("#DivID").html("This is the new html");

5. Script JQuery Mendapatkan dan Merubah Elemen Input Textarea

//--- GET & SET TEXT OF ELEMENT ---//
// get text of element
var DivText = $("#DivID").text();

// set text of element
$("#DivID").text("This is the new text.");

6. Script JQUERY Merubah Lebar dan Tinggi Elemen HTML

//--- GET & SET ELEMENT'S WIDTH & HEIGHT
// get element height
var ElementHeight = $("#DivID").height();

// set element height
$("#DivID").height(300);

// get element width
var ElementWidth = $("#DivID").width();

// set element width
$("#DivID").width(600);

7. Script JQuery Merubah Properti CSS

//--- CHANGE AN ELEMENT'S CSS PROPERTY ---//
$("#DivID").css("background-color", "#000");
$("#DivID").css("border", "solid 2px #ff0000");

8. Script JQuery Toggle Menampilkan dan Menyembunyikan Elemen

//--- JQUERY TOGGLE/SHOW/HIDE ---//
// toggle hide/show of an element
$("#DivID").toggle(1000);

// do something when animation is complete
$("#DivID").toggle(1000, function () {
alert("Toggle Complete");
});

// hide an element
$("#DivID").hide(1000);

// do something when animation is complete
$("#DivID").hide(1000, function () {
alert("Hide Complete");
});

// show an element
$("#DivID").show(1000);

// do something when animation is complete
$("#DivID").show(1000, function () {
alert("Show Complete");
});

9. Script JQuery Fungsi Animasi Slide

//--- JQUERY SLIDE - SLIDE AN ELEMENT IN AND OUT ---//
// toggle slide up and down
$("#DivID").slideToggle(1000);

// do something when animation complete
$("#DivID").slideToggle(1000, function () {
alert("Slide Toggle Complete");
});

// slide up
$("#DivID").slideUp(1000);

// do something when animation is complete
$("#DivID").slideUp(1000, function () {
alert("Slide Up Complete");
});

// slide down
$("#DivID").slideDown(1000);

// do something when animation is complete
$("#DivID").slideDown(1000, function () {
alert("Slide Down Complete");
});

10. Script JQuery Fungsi Animasi Fade

//--- JQUERY FADE - FADE AN ELEMENT IN, OUT & TO ---//
// fade in
$("#DivID").fadeIn(1000);

// do something when animation complete
$("#DivID").fadeIn(1000, function () {
alert("Fade In Complete");
});

// fade out
$("#DivID").fadeOut(1000);

// do something when animation is complete
$("#DivID").fadeOut(1000, function () {
alert("Fade Out Complete");
});

// fade to (fades to specified opacity)
$("#DivID").fadeTo(1000, 0.25);

// do something when animation is complete
$("#DivID").fadeTo(1000, 0.25, function () {
alert("Fade To Complete");
});

11. Script JQuery Fungsi Animasi – Animate

//--- ANIMATE (EXAMPLE USES OPACITY, BUT CAN USE ANY CSS PROPERTY. ---//
//--- NOTE SOME MY REQUIRE THE USE OF A PLUGIN SUCH AS JQUERY COLOR ANIMATION PLUGIN. ---//
$("#DivID").animate({ opacity: 0.25 }, 1000);

// do something when animation complete
$("#DivID").animate({ opacity: 0.25 }, 1000, function () {
alert("Opacity Animation Complete");
});

12. Script JQuery Auto Focus Cursor Form Input Pertama

[removed]
$(document).ready(function() {
// focus on the first text input field in the first field on the page
$("input:text:visible:first").focus();
});
[removed]

Sekian Pos Dari Saya emoticon-Cool Jangan Lupa Kasih emoticon-Blue Guy Cendol (L) Jangan emoticon-Blue Guy Bata (L)

Sumber : http://blog.pusathosting.com/2012/09...angat-penting/
JQUERY itu apaan sih ?
gunanya juga untuk apa gan?
percuma gan buat thread tapi ga ada penjelasannya emoticon-Ngakak (S)

JQUERY Adalah

jQuery Adalah Pustaka JavaScript Kecil Bersumber Terbuka Yang Menekankan Pada Interaksi Antara JavaScript dan HTML.

Sumber : http://id.wikipedia.org/wiki/JQuery
KASKUS Ads
thanks gan, tinggalin jejak dulu siapa tau butuh nanti emoticon-Shakehand2
si maho .. jadi programmer sekarang emoticon-Ngakak postman emoticon-Ngakak

help dong

image-url-apps
nannya gan ... gmn cara paling yahud... buat bsa liat HTML web... dg kondisi ni web di protek abis.. klik knan gb bsa drag apalagi..pdhal javascript pd browser dah dimatiin... trims gan...
Quote:


udah nyoba view-source:http://adaw,com ? emoticon-Bingung (S)

haha, sudah dijadikin file js sendiri gan emoticon-Ngakak
Quote:


kwkwk