ns fire myScan's click events, think very straightforward in
> this case.
>
> On the other hand, when you click on myScan it fires myDiv event
> because of bubbling.
>
> On Dec 31, 11:40 am, nachocab wrote:
>
> > Hi,
> > I was wondering how I could repli
Hi,
I was wondering how I could replicate event delegation while testing.
For example:
hello
$('#myDiv').click(function(e) {
$this = $(e.target)
if ( $this.is('scan') )
$this.toggleClass("selectedScan")
});
When I click on the scan in the browser, it works. But if I d
Allright, so I guess manually going through the contents() array is
the only solution.
The only function that comes close to giving me the index is
jQuery.inArray() (it's really just the for loop that I'm doing with a
different condition), but it doesn't let me specify the id or the
className, so
ldren().each(function(i){
> if ( this.id == 'my_item' ) console.info(i);
>
> });
>
> indexOf is a method of the String object, no use in this case.
>
> On Dec 30, 6:07 pm, nachocab wrote:
>
> > Actually that gives an error. It should be:
> &g
ame
On Dec 30, 8:30 pm, nachocab wrote:
> Hi everyone,
> I'd like to know if there's a way to do this without using a for loop.
> You can just paste this in Firebug:
>
> var $items = $('Helloworld!! id="my_item">Goodnight moon!');
> for(var i=
Hi everyone,
I'd like to know if there's a way to do this without using a for loop.
You can just paste this in Firebug:
var $items = $('Helloworld!!Goodnight moon!');
for(var i=0; i <= $items.children().length; i++){
if ( $items.contents()[i].id == 'my_item' )
console.info(i)
}
Keep
Thanks, you're right.
On Dec 18, 8:01 pm, sad1sm0 wrote:
> you may first need to specify the positioning of the elements as
> absolute or relative. The top style property won't effect the element
> unless the position is first defined.
>
> On Dec 18, 1:24 pm, nacho
Hi guys,
I was testing out animate using firebug and as an example, I'm able to
move every anchor in the www.jquery.com page by typing this in the
console:
$("a").animate( { "top": "-=10px"}, "slow" );
But if I go to this other page: http://flowplayer.org/tools/scrollable.html
which has jQuery in
Hey Dave,
You blew me away with your method; it's so much more elegant than the
madness I was getting into. Thanks a lot! I've got a couple of
questions, though:
1) Is $("#phrases").find("li") faster than $("#phrases li")?, or just
better style?
2) Is there a way not to have to repeat the method t
so;
>
> > $('#my_div').unbind();
> > mybind();
>
> > The reason for the unbind is so that if there are multiple
> > matching items on the page, they will trigger the click event
> > code each time the binding is run until and unbind is called.
> >
de snippet. Can you
> post a link to a test page instead?
>
> -Mike
>
> > From: nachocab
>
> > You're right:
> > __test.js__
> > 1 test("bind div again", function() {
> >
> I am new to jQuery and may not have a lot to offer, but does the
> second function actually fail or does it not run?
>
> On 12/14/08, nachocab wrote:
>
>
>
>
>
> > Hi,
> > I have a test that passes if I run it by itse
Hi,
I have a test that passes if I run it by itself, but if I duplicate
the code and run both of them, the second one fails. What am I doing
wrong?
__test.js___
test("bind div", function() {
$("#my_div").click();
ok( check_if_it_worked, "working")
});
test("bind d
ou can shorten that to:
>
> if ( !$('#phrases li.active').is(':first-child') ) {
>
> On Dec 10, 12:47 pm,nachocab<[EMAIL PROTECTED]> wrote:
>
> > Thanks Richard!
> > You saved my life :-)
>
> > On Dec 10, 2:36 pm, "Richard D. Worth
those two DOM Elements, change
>
> $("#phrases").find("li.active") != $("#phrases").find("li:first")
>
> to
>
> $("#phrases").find("li.active")[0] != $("#phrases").find("li:first")[0]
>
> - R
Hi,
I have this html:
This is my first phrase
This is my second_phrase
And I wanted to do this comparison:
if ( $("#phrases").find("li.active") != $("#phrases").find
("li:first") ) {
alert("the active list-item is not the first one");
}
The problem is the alert pops up, but in this ca
16 matches
Mail list logo