[jQuery] Re: $(' Expert jQuery JS synatx ' ).show

2009-01-19 Thread Ami
Thank you. Very usefull. On Jan 19, 6:41 am, Brandon Aaron brandon.aa...@gmail.com wrote: It works by referencing the method with bracket or array notation. You can reference properties and methods of an object this way. For example: var obj = { test1: 'test_one', test2: 'test_two' }; alert(

[jQuery] Re: $(' Expert jQuery JS synatx ' ).show

2009-01-18 Thread Brandon Aaron
I believe you are looking for the following syntax: $(selector)[ (expr ? 'next' : 'before') ]().show(); -- Brandon Aaron On Sun, Jan 18, 2009 at 9:12 PM, Ami aminad...@gmail.com wrote: Sorry about my grammar, English isn't my lang. I am trying to write code like that: var

[jQuery] Re: $(' Expert jQuery JS synatx ' ).show

2009-01-18 Thread Mauricio (Maujor) Samy Silva
if (expr) { $(seletor).prev().show(); } else { $(seletor).next().show(); } or the short sintax: expr ? $('h2').prev().show() : $('h2').next().show(); Maurício -Mensagem Original- De: Ami aminad...@gmail.com Para: jQuery (English) jquery-en@googlegroups.com Enviada em:

[jQuery] Re: $(' Expert jQuery JS synatx ' ).show

2009-01-18 Thread Ami
Thank you. It's working :) Can you put a function name in an array ?! May you explain me WHY it's working? $('div')[ (true? 'next' : 'before') ]().hide() I tried also this: function a() {alert('Function a')} [expr ? 'a' : 'a']() but it's didn't work. why? On Jan 19,

[jQuery] Re: $(' Expert jQuery JS synatx ' ).show

2009-01-18 Thread Brandon Aaron
It works by referencing the method with bracket or array notation. You can reference properties and methods of an object this way. For example: var obj = { test1: 'test_one', test2: 'test_two' }; alert( obj['test1'] ) // alerts test_one alert( obj.test1 ) // also alerts test_one The other code