[jQuery] Removal of element before body

2009-09-14 Thread paulswansea

Hi,

How can I remove an element before the body of the document, the long
and the short of it is that a script I use places a  statement
(amongst other things) dynamically into my web pages and based upon
which browser I use, sometimes it places it inside the  and
sometimes places it before the  and in some browsers not at all.
I know it shouldn't, but it does.

So basically, is there a way of removing the br statement if it exists
before the body element?


[jQuery] Re: Remove an element but not it's content

2009-08-06 Thread paulswansea

Hi,
Tried both those methods. the plugin ended up deleting all siblings,
and replacewith cant replace it with nothing, but made my own quick
and dirty solution should anyone ever want to know the solution :

***This is a test---

//<![CDATA[
$(document).ready(function(){
  $('a.tester').each(function() {
$(this).before($(this).html()).remove();
  });
});
//]]>


On Aug 6, 4:04 pm, "Richard D. Worth"  wrote:
> It's not built-in, but there are plugins for 
> it:http://www.google.com/search?q=jquery+unwrap
>
> Or you could use replaceWith:
>
> http://docs.jquery.com/Manipulation/replaceWith
>
> <http://www.google.com/search?q=jquery+unwrap>- Richard
>
> On Thu, Aug 6, 2009 at 10:42 AM, paulswansea wrote:
>
>
>
>
>
> > I'm trying to remove a link, but keep the content within, is there a
> > simple way to do this in jquery?
>
> > ***This is a test
>
> > turns into
>
> > ***This is a test- Hide quoted text -
>
> - Show quoted text -


[jQuery] Remove an element but not it's content

2009-08-06 Thread paulswansea

I'm trying to remove a link, but keep the content within, is there a
simple way to do this in jquery?

***This is a test

turns into

***This is a test


[jQuery] Does jquery have a plugin to do this?

2009-07-09 Thread paulswansea

Hi, I'm looking for a jquery plugin that does the 'rays' effect on
http://scripty2.com/ i've had a look, but can't seem to find anything,
I was wondering if anyone had come across something like this before?


[jQuery] jquery validation on one field or another

2009-03-18 Thread paulswansea

Hi,
I have a form with multiple fields, including one for a telephone
number and one for an email address, i need the contact to enter in at
least one of the above in the form to make it valid, how do i do an
either/or check within a jquery validation form?


[jQuery] custom function to run on specific field with jquery validate plugin

2009-03-14 Thread paulswansea

Does anybody know of a way to run a custom function on a specific
field if it is incorrect when validating an entire form?

TIA


[jQuery] Problem importing XML file

2009-03-11 Thread paulswansea

Hi,

I'm trying to import my sitemap.xml file, and the code below works
when i have the alert('.') placed in there, but the moment I
remove it, the data isn't imported, can anyone help?

$.ajax({
type: "GET",
url: "/sitemap.xml",
dataType: "xml",
success: function(xml) {
var name_text;
alert('got it!'); // 
<- IF LINE
REMOVED, CODE BREAKS.
$(xml).find('loc').each(function(){
name_text = $(this).text();
$('#sitemap').append('' + name_text + 
'');
}); //close each(
}
}); //close $.ajax(


[jQuery] Re: Problems getting validate plugin to work with select box

2009-02-26 Thread paulswansea

Many Thanks Jörn! :)

On Feb 26, 9:17 pm, Jörn Zaefferer 
wrote:
> All you need is required. Just remove minlength.
>
> Jörn
>
> On Thu, Feb 26, 2009 at 10:10 PM, paulswansea  
> wrote:
>
> > p.s. i just need the tick or cross instead of the default text, but if
> > i remove the text from the messages :
>
> >                messages : {
> >                        country : {
> >                                required : 'select country',
> >                                minlength : 'choose a country'
> >                        },
> >                },
>
> > to
> >                messages : {
> >                        country : {
> >                                required : '',
> >                                minlength : ''
> >                        },
> >                },
>
> > the permanent cross changes into a permanent tick no matter what i
> > select, it's fine with input boxes, but the select doesnt work the
> > same way.
>
> > On Feb 26, 9:04 pm, Jörn Zaefferer 
> > wrote:
> >> You specify minlength:2 for a single-select. There is no way to select
> >> more then one item in that select.
>
> >> Jörn
>
> >> On Thu, Feb 26, 2009 at 10:03 PM, paulswansea  
> >> wrote:
>
> >> > sure, tryhttp://www.jondunlevy.com/seltest.html
>
> >> > On Feb 26, 8:54 pm, Jörn Zaefferer 
> >> > wrote:
> >> >> Your code looks fine, could you post a testpage?
>
> >> >> Jörn
>
> >> >> On Thu, Feb 26, 2009 at 9:53 PM, paulswansea 
> >> >>  wrote:
>
> >> >> > I'm trying to get the validate plugin to work with a select box, but
> >> >> > for some reason, it wont validate if i select a country, what am i
> >> >> > doing wrong?
>
> >> >> > 
> >> >> >        
> >> >> >                Select a country
> >> >> >                Afghanistan
> >> >> >                Aland Islands
> >> >> >                Albania
> >> >> >                Wales
> >> >> >        
> >> >> >        
> >> >> > 
> >> >> > 
> >> >> >        $('#testform').validate({
> >> >> >                messages : {
> >> >> >                        country : {
> >> >> >                                required : 'select country',
> >> >> >                                minlength : 'choose a country'
> >> >> >                        },
> >> >> >                },
> >> >> >                rules : {
> >> >> >                        country : {
> >> >> >                                required : true,
> >> >> >                                minlength: 2
> >> >> >                        },
> >> >> >                },
> >> >> >                success: function(label) {
> >> >> >                        label.html(" ").addClass("checked");
> >> >> >                }
>
> >> >> >        });
>
> >> >> > 


[jQuery] Re: Problems getting validate plugin to work with select box

2009-02-26 Thread paulswansea

p.s. i just need the tick or cross instead of the default text, but if
i remove the text from the messages :

messages : {
country : {
required : 'select country',
minlength : 'choose a country'
},
},

to
messages : {
country : {
required : '',
minlength : ''
},
},

the permanent cross changes into a permanent tick no matter what i
select, it's fine with input boxes, but the select doesnt work the
same way.





On Feb 26, 9:04 pm, Jörn Zaefferer 
wrote:
> You specify minlength:2 for a single-select. There is no way to select
> more then one item in that select.
>
> Jörn
>
> On Thu, Feb 26, 2009 at 10:03 PM, paulswansea  
> wrote:
>
> > sure, tryhttp://www.jondunlevy.com/seltest.html
>
> > On Feb 26, 8:54 pm, Jörn Zaefferer 
> > wrote:
> >> Your code looks fine, could you post a testpage?
>
> >> Jörn
>
> >> On Thu, Feb 26, 2009 at 9:53 PM, paulswansea  
> >> wrote:
>
> >> > I'm trying to get the validate plugin to work with a select box, but
> >> > for some reason, it wont validate if i select a country, what am i
> >> > doing wrong?
>
> >> > 
> >> >        
> >> >                Select a country
> >> >                Afghanistan
> >> >                Aland Islands
> >> >                Albania
> >> >                Wales
> >> >        
> >> >        
> >> > 
> >> > 
> >> >        $('#testform').validate({
> >> >                messages : {
> >> >                        country : {
> >> >                                required : 'select country',
> >> >                                minlength : 'choose a country'
> >> >                        },
> >> >                },
> >> >                rules : {
> >> >                        country : {
> >> >                                required : true,
> >> >                                minlength: 2
> >> >                        },
> >> >                },
> >> >                success: function(label) {
> >> >                        label.html(" ").addClass("checked");
> >> >                }
>
> >> >        });
>
> >> > 


[jQuery] Re: Problems getting validate plugin to work with select box

2009-02-26 Thread paulswansea

sorry, so how do i check if the value is not blank? (i.e. not the
first option)

On Feb 26, 9:04 pm, Jörn Zaefferer 
wrote:
> You specify minlength:2 for a single-select. There is no way to select
> more then one item in that select.
>
> Jörn
>
> On Thu, Feb 26, 2009 at 10:03 PM, paulswansea  
> wrote:
>
> > sure, tryhttp://www.jondunlevy.com/seltest.html
>
> > On Feb 26, 8:54 pm, Jörn Zaefferer 
> > wrote:
> >> Your code looks fine, could you post a testpage?
>
> >> Jörn
>
> >> On Thu, Feb 26, 2009 at 9:53 PM, paulswansea  
> >> wrote:
>
> >> > I'm trying to get the validate plugin to work with a select box, but
> >> > for some reason, it wont validate if i select a country, what am i
> >> > doing wrong?
>
> >> > 
> >> >        
> >> >                Select a country
> >> >                Afghanistan
> >> >                Aland Islands
> >> >                Albania
> >> >                Wales
> >> >        
> >> >        
> >> > 
> >> > 
> >> >        $('#testform').validate({
> >> >                messages : {
> >> >                        country : {
> >> >                                required : 'select country',
> >> >                                minlength : 'choose a country'
> >> >                        },
> >> >                },
> >> >                rules : {
> >> >                        country : {
> >> >                                required : true,
> >> >                                minlength: 2
> >> >                        },
> >> >                },
> >> >                success: function(label) {
> >> >                        label.html(" ").addClass("checked");
> >> >                }
>
> >> >        });
>
> >> > 


[jQuery] Re: Problems getting validate plugin to work with select box

2009-02-26 Thread paulswansea

sure, try http://www.jondunlevy.com/seltest.html


On Feb 26, 8:54 pm, Jörn Zaefferer 
wrote:
> Your code looks fine, could you post a testpage?
>
> Jörn
>
> On Thu, Feb 26, 2009 at 9:53 PM, paulswansea  
> wrote:
>
> > I'm trying to get the validate plugin to work with a select box, but
> > for some reason, it wont validate if i select a country, what am i
> > doing wrong?
>
> > 
> >        
> >                Select a country
> >                Afghanistan
> >                Aland Islands
> >                Albania
> >                Wales
> >        
> >        
> > 
> > 
> >        $('#testform').validate({
> >                messages : {
> >                        country : {
> >                                required : 'select country',
> >                                minlength : 'choose a country'
> >                        },
> >                },
> >                rules : {
> >                        country : {
> >                                required : true,
> >                                minlength: 2
> >                        },
> >                },
> >                success: function(label) {
> >                        label.html(" ").addClass("checked");
> >                }
>
> >        });
>
> > 


[jQuery] Problems getting validate plugin to work with select box

2009-02-26 Thread paulswansea

I'm trying to get the validate plugin to work with a select box, but
for some reason, it wont validate if i select a country, what am i
doing wrong?



Select a country
Afghanistan
Aland Islands
Albania
Wales




$('#testform').validate({
messages : {
country : {
required : 'select country',
minlength : 'choose a country'
},
},
rules : {
country : {
required : true,
minlength: 2
},
},
success: function(label) {
label.html(" ").addClass("checked");
}

});




[jQuery] Having problems getting index() and closest() to work

2009-02-05 Thread paulswansea

Hi,

I have a page with multiple tables, and need to get the index value of
a cell with a price which i click on, so i can extract the relevent
quantity within the row above, i've tried using the index() function
but to no avail!

also, I wish to extract the content of the previous h2 header, i'm not
sure if closest('h2') is the best way to do it, but it also doesn't
work, could someone please tell me how to do this?

Please see below for the code (note that there is roughly about ten
tables to which i've cut down to two for here, also I CANNOT change
the tables i.e. add id or classes anywhere, so the tables have to stay
the way they are, I just need to get some jquery code to work around
this and extract the relevant data).

So a brief run down of what i need to do :

1) get the quantity above the price that is clicked
2) get the content of the heading above the relevant table

THE CODE :

First Item Named here
information goes here

  
 Quantity
 1000 
 5000 
 10,000 
 15,000 
 20,000 
  
  
 Price 
£400
  40p each
£1650
  33p each
£3200
  32p each
£4800
  32p each
£6200
  31p each
  

second Item Named here
information goes here

  
 Quantity
 1000 
 5000 
 10,000 
 15,000 
 20,000 
  
  
 Price 
£400
  40p each
£1650
  33p each
£3200
  32p each
£4800
  32p each
£6200
  31p each
  


//



[jQuery] How can I extract the index of an item based within a table?

2009-02-04 Thread paulswansea

Hi,

I'm trying to write some jquery code so when i click on the relevent
item price, it alerts me with the quantity of that item and also
displays the content of the h2 header just before the relevant table,
is there a way somehow of finding out the index of the 'td' which is
clicked, and then extracting the quantity in the row above with the
same index. also be able to grab the text from the h2 header before
the table, so in effect, when i click on the '40p each' box within the
first item table, it alerts me with the quantity being 1000, and also
the h2 header of 'First Item Named here' Can someone please help!?

Example :

First Item Named here
information goes here


 Quantity
 1000 
 5000 
 10,000 
 15,000 
 20,000 


 Price 
£400
40p each
£1650
33p each
£3200
32p each
£4800
32p each
£6200
31p each



second Item Named here
information goes here


 Quantity
 1000 
 5000 
 10,000 
 15,000 
 20,000 


 Price 
£400
40p each
£1650
33p each
£3200
32p each
£4800
32p each
£6200
31p each




//



[jQuery] How do i extract the index of an item based within a table?

2009-02-04 Thread paulswansea

Hi,

I'm trying to write some jquery code so when i click on the relevent
item price, it alerts me with the quantity of that item and also
displays the content of the h2 header just before the relevant table,
is there a way somehow of finding out the index of the 'td' which is
clicked, and then extracting the quantity in the row above with the
same index. also be able to grab the text from the h2 header before
the table, so in effect, when i click on the '40p each' box within the
first item table, it alerts me with the quantity being 1000, and also
the h2 header of 'First Item Named here' Can someone please help!?



Example :

First Item Named here

information goes here

Quantity 1000 5000 10,000 15,000 20,000
Price £400
40p each
£1650
33p each
£3200
32p each
£4800
32p each
£6200
31p each

second Item Named here

information goes here

Quantity 1000 5000 10,000 15,000 20,000
Price £400
40p each
£1650
33p each
£3200
32p each
£4800
32p each
£6200
31p each


[jQuery] How do i extract the index of an item based within a table?

2009-02-04 Thread paulswansea

Hi,

I'm trying to write some jquery code so when i click on the relevent
item price, it alerts me with the quantity of that item and also
displays the content of the h2 header just before the relevant table,
is there a way somehow of finding out the index of the 'td' which is
clicked, and then extracting the quantity in the row above with the
same index. also be able to grab the text from the h2 header before
the table, so in effect, when i click on the '40p each' box within the
first item table, it alerts me with the quantity being 1000, and also
the h2 header of 'First Item Named here' Can someone please help!?



Example :

First Item Named here
information goes here


 Quantity
 1000 
 5000 
 10,000 
 15,000 
 20,000 


 Price 
£400
40p each
£1650
33p each
£3200
32p each
£4800
32p each
£6200
31p each



second Item Named here
information goes here


 Quantity
 1000 
 5000 
 10,000 
 15,000 
 20,000 


 Price 
£400
40p each
£1650
33p each
£3200
32p each
£4800
32p each
£6200
31p each




//