var jqxhr = $.get('example.php', function () { alert('Success!') })
.find() and .children() methods are similar, except that the latter only travels a single level down the DOM tree.
Classes:
$("p").removeClass("myClass noClass").addClass("yourClass")
http://stefangabos.ro/jquery/jquery-plugin-boilerplate-oop/
var newElement = $('
Test
').appendTo('.parentClass') var parentElement = $('.parentClass').append('Test
')$('#parentElement').empty()
var getElementPosition = function (selector) { var elementPos = $(selector).position() return [elementPos.left, elementPos.top] }
var setElementPosition = function (selector, pos) { $(selector).css({ left: pos[0] + 'px', top: pos[1] + 'px' }) }
$('#firstname').focus()
textboxValue = $('#mytextbox').val()
if (
$('form.edit_task').submit(checkForm)
$('#album1').css('left', this.x + 'px')
$(elementId).animate({ top: '+=50', //width: ['toggle', 'swing'] }, 1000, animateBack(elementId) )
var animatePulse = function (elem, duration, easing, props_to, props_from, until) { elem.animate(props_to, duration, easing, function () { if (until() === false) { animatePulse(elem, duration, easing, props_from, props_to, until) } } ) }
var pulseCounter = 0
animatePulse($('#user-register'), 500, 'linear', {opacity: 0.5}, {opacity: 1},
function () {
pulseCounter++
return (pulseCounter >= 10)
}
)
Note: include both JQuery and JQuery-UI!
Extending JQuery
// Check if the element has a certain CSS property $.fn.hasCssProperty = function (wantedParameter) { if (this.cssProperty(wantedParameter)) return true else return false }