I am working on a script and not sure why this isn't working
function moveIn($selector) {
if( $( $selector[left] ) != null ){
$direction = 'left';
}else{
$direction = 'right';
}
This is does work:
if( $( '#hello[left]' ) != null ){
This is essentially what I am trying to get spit out. It seems the brackets are causing the problem. How else would this be written? Tips for future coding? Thanks
Entire function:
function moveIn($selector) {
if( $( $selector + '[left]' ) != null ){
$direction = 'left';
}else{
$direction = 'right';
}
var animation = {};
animation[$direction] = 0;
$($selector).animate(animation, 1500);
}
$in front of nearly all your variables; it may have some usefulness if it's a jQuery object.