Hey guys,
I'm just starting with jquery and I've hit what seems to be
inconsistant behaviour. I have the following markup:
<form action="">
<span class="control date">
<input id="someID" type="text" value="HI" />
<input type="hidden" value="Huh?" class="meta" />
</span>
<br />
</form>
The values are only there becuase I had problems and I wanted to test stuff.
I then wrote the following javascript:
$(document).ready(function(){
$("form .control.date").each( function(i){
var me = $(this)
alert( me.find( '[EMAIL PROTECTED]"text"]').val() );
alert( me.find( '[EMAIL PROTECTED]"hidden"]').val() );
alert( me.find( 'input.meta').val() );
} );
});
Now this made sense to me at the time, but I've learned of better ways
to do this.
Now using the FULL jquery library, I get "HI" followed by NULL twice.
When I was using only the base and event modules (I think.. no ajax or
animation) I got back an jQuery object.
I've since learned that this is the better way to do it:
alert($('[EMAIL PROTECTED]"hidden"]', this).val())
It seems to me a flaw in jQuery that such a thing could happen. First
getting different results for the same (more or less) operation is a
bad thing but also having different things come back seems like a bad
idea.
Adam
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/