[jQuery] DOM problem within AJAX call

2009-05-16 Thread Brendon Gleeson

I have been stuck on this problem for almost 2 days now, consider the
following code:

'.country-select' occurs twice in the form (select input),

$('.branch-row').hide();
$('.country-select').change(function(){
console.log($(this));
country_select = $(this);
$.get('get_country_branches.php',
'country=' + $('# + country_select.attr('id') + 
option:selected').val() + 'field=' + $(':input:eq('+($
(:input).index(country_select) + 1) +')').attr('name'),
function(html){
$(':input:eq('+($(:input).index(country_select) + 1)
+')').html(html);
//debug 1
console.log(country_select);
country_select.parent().parent().next().show();
},
'html'
);

}).change();
//debug 2
console.log(country_select);

the output from the debug 1 are both the same object:

[select#pays-dem.country-select]
[select#pays-dem.country-select]

however the output from debug 2 is correct:

[select#pays-enlev.country-select]
[select#pays-dem.country-select]

It seems that the problem lies within the $.get() AJAX function and
the country_select object.. Any idea wtf is going on?


[jQuery] Validate plugin not working

2009-03-23 Thread Brendon Gleeson

I have been trying all day to get the latest validate plugin to work
with the latest jquery. It works when I specify the keywords in the
class name, but when I try writing the code only in javascript {rules:
{}} nothing happens, no error no nothing just nothing. This is doing
my nut. The example below I made, should work according to the
docs,but it doesn't.

html
head
titlejQuery Validation test/title
script type=text/javascript src=js/jquery-1.3.2.min.js/script
script type=text/javascript src=js/jquery-validate/
jquery.validate.js/script
script type=text/javascript
$(document).ready(function(){
$(#myForm).validate({
rules : {
required : true
}
});
});

/script
/head
body
form id=myForm
input type=text id=name class=required /
input type=submit /
/form
/body
/html


[jQuery] Validate plugin not working

2009-03-23 Thread Brendon Gleeson

Sorry I couldn't wait for my other post to showup, so I made a typo:

html
head
titlejQuery Validation test/title
script type=text/javascript src=js/jquery-1.3.2.min.js/script
script type=text/javascript src=js/jquery-validate/
jquery.validate.js/script
script type=text/javascript
$(document).ready(function(){
$(#poesForm).validate({
rules : {
name: {
   required : true
   }
}
});
});

/script
/head
body
form id=poesForm
input type=text id=name class=required /
input type=submit /
/form
/body
/html