Well, what is the value of the src attribute in Chrome (if it's not
what is should be)?
Have you made sure that the arguments t and filename are strings?
On Aug 11, 5:35 pm, Julijan Andjelic
wrote:
>
wow... I'm not even sure what your are trying to achieve with thisno
need for doing this through the onclick attribute, and I can't think why
you are trying to set the onclick with some javascript?
Julijan Andjelic wrote:
$("#sitemap a:eq(1)").attr("onclick","$('#sitemap a:eq(2)').text(
If I remember right, IE6 has issues with creating elements without
using createElement() and adding attributes to them afterwards. Using
the method that Hector specified to create the element should prevent
the issue from occuring in IE6.
On Jul 20, 8:59 am, Hector Virgen wrote:
> This seems pos
This seems possible with vanilla javascript (IE6 does not crash).
// Vanilla Javascript -- works in IE6
var link = document.createElement('link');
link.type = 'text/css';
link.href = 'foo.css';
link.rel = 'stylesheet';
link.media = 'screen';
document.getElementsByTagName('head')[0].appendChild(link
I experienced the same problem while developing a plugin that does
some tricks with the page content during the ready event. I noticed
that attr('href') works fine if I don't manipulate the body tag
content. IE won't return the correct href attribute if I do so.
The code I used to workaround the
Right, it's not hard, it was just unexpected is all. I guess I've
gotten used to JQuery working the same in all browsers.
I've got it working now with some old-fashioned Javascript. Thanks!
On Mar 25, 3:20 pm, Shane Riley wrote:
> Alright, so your example shows the actual strings for all three
Well, the string manipulation is pretty minimal. Just use
this.pathname -- or some combination of this.pathname, this.hash, and
this.search if necessary.
The one problem with this.pathname is that IE and Opera omit the
initial slash while FF and Safari include it. But that's not hard to
Alright, so your example shows the actual strings for all three values
in Safari, and in IE7(Vista) it shows the absolute path for #3. After
looking back at my code, I'm actually loading in the links via Ajax
when the page is loaded, so they're not in the original document. So
I'm guessing that me
Hi Shane,
Yes, I believe you're reading me right. Strange, though. I'm not able
to reproduce the problem you're having. Take a look here:
http://test.learningjquery.com/href.html
In IE 7 for #1 and #2 $(this).attr('href') is reporting the actual
text string of the href attribute while this
After replacing $(this).attr("href") with this.getAttribute("href", 2)
I get the same result. If I output the attribute, IE still shows the
absolute path.
On Mar 25, 2:21 pm, Shane Riley wrote:
> Karl, I'm pretty sure I'm reading you right, but are you saying that
> by all accounts JQuery should
Karl, I'm pretty sure I'm reading you right, but are you saying that
by all accounts JQuery should account for this and return the string-
literal value of href and not IE's absolute path? If so, it's not
working properly. I wish I could show you the live code, because it's
probably easier to visu
Hi Shane,
IE has a second "flag" argument for getAttribute that, when set to 2,
is supposed to get the literal value of the attribute rather than
their special-sauce value.
So, this.getAttribute('href', 2) *should* get the relative href.
(note: no need to do $(this)[0] ; this works just f
Ha! I looked at your post too fast, and didn't notice that it was pure
Javascript. Sorry. I'll try it and see.
The way I currently have it will not work with javascript turned off
either. I'm doing it this way only because the client is requiring the
user to have Javascript enabled to use the sit
On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:
Thanks for the article link, but your proposed change isn't valid
JQuery, is it? My exact jQuery code to read in the value looks like
this:
pageID = $(this).attr("href");
Adding what you suggested to make it $(this)[0].attr("href") will not
do anyt
Thanks for the article link, but your proposed change isn't valid
JQuery, is it? My exact jQuery code to read in the value looks like
this:
pageID = $(this).attr("href");
Adding what you suggested to make it $(this)[0].attr("href") will not
do anything apart from force the link to be followed.
I
On Mar 25, 2009, at 4:32 PM, Shane Riley wrote:
I'm wanting to read in the exact string that's contained in an
anchor's href attribute in order to use it as the POST variable list
for an Ajax call to a PHP script, however in IE6 and 7 the string read
from the href attribute ends up being the a
This works fine for me (using jQuery 1.3):
$(function(){
$('').attr('id','test').html('div html').appendTo
('body'); // inject html element, also works fine hard-coded.
$('#test').attr('ryantest','hithere');
$('a').click(function(event){
event.preventDefaul
I don't think it works.
You might consider using the Metadata plugin:
http://plugins.jquery.com/project/metadata
or jQuery's jQuery.data:
http://docs.jquery.com/Core/data
to achieve what you want to do in a similar way.
On Feb 9, 6:05 am, Tom Shafer wrote:
> sorry about that
>
> $('#projecti
sorry about that
$('#projectid').attr('link')
this is going into ajax post
On Feb 9, 10:59 am, MorningZ wrote:
> Maybe showing an example of what isn't working would help others help
> you
>
> On Feb 9, 10:28 am, Tom Shafer wrote:
>
> > Does the attr feature let me capture my own attribute i
Maybe showing an example of what isn't working would help others help
you
On Feb 9, 10:28 am, Tom Shafer wrote:
> Does the attr feature let me capture my own attribute inside a
> element. I am trying and it doesnt seem to be working. I just
> wondering if there was a way to do this.
>
> Thanks
Hi Liam Potter,
Yeah u have to pass dynamic id for those input field then u have to pass
those id on ur events
hope this will help u :)
If ur not using dynamic id then obviously it will get first input only b'coz
its taking that
on top of ur input fields .
regards
Ragx
On Thu, Feb 5, 2009 at 6
var current = $("input:focus").attr("alt");
obiwanknothe wrote:
I have created a form that has multiple input tags (6 to 8) and I am
using the "alt" attribute of the of the input tag to to retrieve
information with this method "var current = $("input").attr("alt");".
While this works on the
What does your HTML look like?
On Jan 9, 12:47 am, bob wrote:
> Female
> Male
>
> var type = #('inp...@name=gender]').attr('type');
>
> alert(type);
>
> Why do I get checkbox instead of radio?
I just checked. I am getting "radio"!
Read jQuery HowTo Resource - http://jquery-howto.blogspot.com
On Fri, Jan 9, 2009 at 7:47 AM, bob wrote:
>
> Female
> Male
>
> var type = #('inp...@name=gender]').attr('type');
>
> alert(type);
>
> Why do I get checkbox instead of radio?
I'm not sure where you are getting your documentation from, but
"@param" is depreciated
this code gives "radio"
http://paste.pocoo.org/show/98695/
On Jan 8, 9:47 pm, bob wrote:
> Female
> Male
>
> var type = #('inp...@name=gender]').attr('type');
>
> alert(type);
>
> Why do I get checkbox i
Damn, don't know how I missed that. Thanks for pointing that out.
Appreciate it.
On Oct 30, 9:53 am, ricardobeat <[EMAIL PROTECTED]> wrote:
> You need quotes for the attributes:
>
> append('
> >');
>
> Interesting use of the attr() function, I thought doing that would
> make href="".
>
> On
You need quotes for the attributes:
append('');
Interesting use of the attr() function, I thought doing that would
make href="".
On Oct 29, 9:33 pm, Nathan <[EMAIL PROTECTED]> wrote:
> I'm using attr('title') to find the title of the first anchor in a
> list and then make that title the value o
jQuery is supposed to briefly "show" the element to get its height/
width, then hide it again, this shouldn't be happening. Is your page
valid xhtml? Couldn't you set the height and width inline attributes
for the image?
- ricardo
On Oct 23, 1:51 pm, diego <[EMAIL PROTECTED]> wrote:
> I've done
I've done it...i don't use display:none , instead i use
visibility:hidden hideing the elements by js, works fine in all
browser...
http://www.pirolab.it/piro_09/index2.html
tnx again
Diego
On 23 Ott, 16:46, diego <[EMAIL PROTECTED]> wrote:
> weidc i found the bug, at the elements with css 'dis
weidc i found the bug, at the elements with css 'display:none' IE
gives width and height = 0, that's why i have in return 0-0, i think
i'll work on it, trying to overcome this IE bug..
Anyway thank you very much for support..
Diego
On 23 Ott, 16:16, weidc <[EMAIL PROTECTED]> wrote:
> oh my god
oh my god this sucks. kind of frustrating huh?
i'll keep on thinking about it.
-weidc
On 23 Okt., 15:56, diego <[EMAIL PROTECTED]> wrote:
> Hi weidc, look at this..i've changed the .attr :
>
> var litebox = $(this).attr('rel');
> var altezza = $('#'+litebox+'>img.lite').attr('alt');
>
> and the
hi weidc, i've changed the .attr:
var altezza = $('#'+litebox+'>img.lite').attr('alt');
var larghezza = $('#'+litebox+'>img.lite').attr('title');
and it works fine in ie6/7
http://www.pirolab.it/piro_09/index2.html
but i can't use that attributes, i have to find a better way to do it.
Any
Hi weidc, look at this..i've changed the .attr :
var litebox = $(this).attr('rel');
var altezza = $('#'+litebox+'>img.lite').attr('alt');
and the html
and it works in ie6/7 , i really don't understand..
http://www.pirolab.it/piro_09/index2.html
On 23 Ott, 15:23, weidc <[EMAIL PROTECTED]>
mh ye i see.
can't even change the attr in ie itself 'cause it always gets 0 again.
maybe it doesn't like that > in $('#'+litebox+'>img.lite').
atm i don't see a mistake in your script.
-weidc
On 23 Okt., 14:27, diego <[EMAIL PROTECTED]> wrote:
> The problem is that the my elements are 'display
The problem is that the my elements are 'display:none' that's why if i
try your code the alert returns 0-0,
i need to use .attr, height and width..
Diego
On 23 Ott, 14:08, diego <[EMAIL PROTECTED]> wrote:
> here an exemplehttp://www.pirolab.it/piro_09/index2.html
>
> the first three thumbs of t
here an exemple http://www.pirolab.it/piro_09/index2.html
the first three thumbs of the first box
diego
On 23 Ott, 14:00, diego <[EMAIL PROTECTED]> wrote:
> Hi all, I'm building a gallery, and so far it works in every browser
> except Internet Explorer,
> The problem is that IE (burns to hell)
hi,
what about using:
$('#'+litebox+'>img.lite').width();
and
$('#'+litebox+'>img.lite').height();
?
-weidc
On 23 Okt., 14:00, diego <[EMAIL PROTECTED]> wrote:
> Hi all, I'm building a gallery, and so far it works in every browser
> except Internet Explorer,
> The problem is that IE (burns to
That simply doesn't work on IE. Use bind() instead.
--
Ariel Flesler
http://flesler.blogspot.com/
On Aug 24, 8:41 am, Sarbesh <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i'm new to jquery and i'm having some problem.
>
> the code below works fine in FF3.0 but doesn't work with IE 6.0.
> i used it to sh
Your totally removing the onclick, so when your trying to modify it, it no
longer exists.
function show_hidden_row(id,a_id){
$(id).show();
$(a_id).attr("onclick","hide_shown_row('"+id+"','"+a_id+"')");
$(a_id).html('');
}
--- On Sun, 8/24/08, Sarbesh
Oh sweet, thanks you two, that clears it up for me. I knew I was
missing something.
Cheers,
Dana
On Jul 24, 2:52 pm, MorningZ <[EMAIL PROTECTED]> wrote:
> And just so it makes sense on why Karl's answers are what they are is
> that in
>
> $('img.thumb').each(function() {
> var alt = thi
Also attr('style', 'prop:val') replaces the entire inline style. css()
just replaces that property.
Danny
On Jul 19, 12:37 pm, Geir <[EMAIL PROTECTED]> wrote:
> Thanks!
Thanks!
Yes, (2) is cleaner than (1) IMO.
(3) isn't synchronous and requires additional proccessing (bad).
--
Ariel Flesler
http://flesler.blogspot.com/
On 19 jul, 05:54, Geir <[EMAIL PROTECTED]> wrote:
> Hi all!
>
> What's the difference between:
>
> 1. attr(style: "prop./val.")
> 2. css({prop./val.})
You should probably report that somewhere, for IE8, specially as it's
still beta.
--
Ariel Flesler
http://flesler.blogspot.com
On 10 jun, 10:55, jrabbit <[EMAIL PROTECTED]> wrote:
> I've just discovered a slight compatibility issue with the IE8 beta
> when running in the default standards mode.
No, no API changes, .attr() is still .attr().
But it has been modified and a lot of existing issues were fixed.
--
Ariel Flesler
http://flesler.blogspot.com
On 20 mayo, 18:10, David McFarland <[EMAIL PROTECTED]> wrote:
> On May 20, 2008, at 12:47 PM, Ariel Flesler wrote:
>
>
>
> > So.. Have you
On May 20, 2008, at 12:47 PM, Ariel Flesler wrote:
So.. Have you tried using jQuery 1.2.4 ?
jQuery.attr works completely different now.
It does? Do you mean there are API changes?
thanks
--dave
So.. Have you tried using jQuery 1.2.4 ?
jQuery.attr works completely different now.
--
Ariel Flesler
http://flesler.blogspot.com
On 20 mayo, 08:35, Sid <[EMAIL PROTECTED]> wrote:
> Karl,
>
> Thanks a lot :-)
>
> Works perfectly well. But IE still shows an error notification in the
> status bar.
On May 20, 1:35 pm, Sid <[EMAIL PROTECTED]> wrote:
> Karl,
>
> Thanks a lot :-)
>
> Works perfectly well. But IE still shows an error notification in the
> status bar. I'm just afraid it might come in between as I add more
> features. Any ideas?
>
> Regards
The "original blue" anchor has a mous
Hi Sid,
Unfortunately, I'm not sure where that error message is coming from. I
have no experience with the LiveQuery plugin, so I can't say if it's
from that. Are you running other JavaScript code that might be causing
the error?
$('#preview').livequery(function() {
$('#preview'
Karl,
Thanks a lot :-)
Works perfectly well. But IE still shows an error notification in the
status bar. I'm just afraid it might come in between as I add more
features. Any ideas?
Regards
Hi Sid,
yeah, IE error messages are rarely helpful.
You might want to try using the .css() method for width and height,
rather than the .attr() method:
$('#preview').livequery(function() {
$('#preview')
.attr('src',previewImage)
.css({width: '302px',
I would upgrade to the latest version of jQuery, there's a few
attribute bugfixes that could help
J
On May 20, 6:01 am, Sid <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm using the .attr() to set attributes of an img tag.
>
> This works in Firefox 2.0.0.14 but not in Internet Explorer 7.
>
> The offen
I don't think it is correct to call this an attribute, as this implies
that you can specify it in the HTML (it is not an allowed attribute in
the W3C specification). It should be a cross-browser property of all
form elements though.
on 19/05/2008 15:54 Ariel Flesler said::
> No, you're right.
1.2.4 is available ... just not the release notes :)
http://code.jquery.com/jquery.js
--
Brandon Aaron
On Mon, May 19, 2008 at 9:54 AM, Ariel Flesler <[EMAIL PROTECTED]> wrote:
>
> No, you're right. Form elements (input, select, textarea, etc) do have
> a 'form' attribute. I think it's even cros
No, you're right. Form elements (input, select, textarea, etc) do have
a 'form' attribute. I think it's even cross-browser.
Your code WILL work with the new version (1.2.4) which will be
(hopefully) released soon.
If you want to verify this will work, you can get it by doing a
checkout:
http://c
Thanks all, it must be my misunderstanding of the dom.
If I understand correctly you are trying to reference the parent form
of the input field.
You should do it like this:
var form = $("#a").parent("form");
alert( form.attr("action"); );
On May 19, 3:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> This is my html:
>
>
>
> and javascript:
As the previous reply stated, there is no attribute "form" on the input
element, but there is a "form" property on the input object which can be
used to identify the form which the input is an ancestor of. If you need the
form object in your example, all you need to do is select it using
$('#myFo
It looks like you're just trying to get the action on the form?
$('#a').attr('action');
On May 19, 2:53 am, "Matt Quackenbush" <[EMAIL PROTECTED]> wrote:
> Unless I'm completely misunderstanding something here, that code should not
> "work" in any browser. There is no "form" attribute on an
>
Just like I dont specify a width or height attribute to input but it
actually has one, an input residing in a form automatically have a
'form' attribute whose value references the parent form, so I think it
should work.
Unless I'm completely misunderstanding something here, that code should not
"work" in any browser. There is no "form" attribute on an
element. What are you actually trying to accomplish?
On Sun, May 18, 2008 at 8:22 PM, wrote:
>
> This is my html:
>
>
>
> and javascript:
>
Fixed it anyway
Sacked the idea of using custom attributes completely.
Hi bohdan
your oneliner works fine :) thanks
but the problem is still there.
Maybe is just a conflict with another script but it's weird that it
happens only in one page..
i'll check better..
thanks vitto
On Jan 31, 7:32 pm, besh <[EMAIL PROTECTED]> wrote:
> Hi vitto,
>
> are you sure that the pr
hcvitto wrote:
: hi i'm using this code to add the target=_blank attribute to links.
:
: $("a[href]").each(function(){
: if ($(this).hasClass("ppt") || $(this).hasClass("pdf") || $
: (this).hasClass("allegato") || $(this).hasClass("doc") || $
: (this).hasClass("jpg") || $(this).has
Hi vitto,
are you sure that the problem isn't somewhere else? Link would be
fine...
Anyway, I have a tip for you. What about to make this a oneliner:
$('a.ppt, a.pdf, a.allegato, a.doc, a.jpg, a.xls, a.external,
a.zip').attr('target','_blank');
--
Bohdan Ganicky
On Jan 31, 3:46 pm, hcvitto <[
looks like the attribute "name" is not supported in IE6
On Jan 16, 12:50 pm, skatta <[EMAIL PROTECTED]> wrote:
> in this issue First off ... i'm using ajax to pull elements into the
> DOM. So my code uses this (there are probably better ways to do
> this) ...
>
> $(document).ready(function() {
>
oops ... in my example i used event.target.id ... it's event.target
like so ...
$(document).ready(function() {
$('body').click(function(event) {
if ($(event.target).is('.touchRfq')) {
var touchco = $(event.target).attr("name");
alert(touchco);
});
});
});
On Jan 16, 12:50 pm, skatta <[E
Thanks Jeffrey, Glen, Steve, Gordon and Erik
Sorry it took so long to reply, I was steeped in development work which
can (finally) go live tomorrow.
The reason I was trying to do this was as part of the checkout form for
a shopping platform. I have 2 sets of address fields, one for delivery
See also, this thread:
http://groups.google.com/group/jquery-en/browse_thread/thread/b1e3421d00104f17/88b1ff6cab469c39
--Erik
On 10/29/07, Robert O'Rourke <[EMAIL PROTECTED]> wrote:
>
>
> Hi, does $("some selector").attr("type","hidden") work for anyone?
>
> I'm getting this in firebug:
>
> [Ex
I tried alternatives, but none worked. Jeffrey's version worked well.
I whipped up a demo using his code.
http://www.commadot.com/jquery/hiddenFields.php
Glen
On 10/29/07, Jeffrey Kretz <[EMAIL PROTECTED]> wrote:
>
>
> If you are trying to change the type of an input element from, say,
> type="t
If you're trying to select hidden fields, then use $('input:hidden')
or $('input[type='hidden'])
If you are trying to make selected form fields invisible then use $
('input').hide ();
On Oct 29, 3:56 pm, Robert O'Rourke <[EMAIL PROTECTED]> wrote:
> Hi, does $("some selector").attr("type","hidden
If you are trying to change the type of an input element from, say,
type="text" to type="hidden", this isn't really supported by very many
browsers.
You could do something like this, however:
var input = $('#blabla');
var hidden = $('').insertBefore(input);
input.remove();
JK
-Original Mess
Did you mean $('input[type='hidden'])? Your code is trying to set the
type attribute. It looks like you want to select a field with a type of
hidden
--
Steve "Cutter" Blades
Adobe Certified Professional
Advanced Macromedia ColdFusion MX 7 Developer
_
http://blo
Map is really nice for this.
var attributes = $('.selected').map(function() { return $(this).attr('rel');
});
VP
groups.com
Subject: [jQuery] Re: Attr calls on jQuery object with more than one
element?
That is true, that is the correct behaviour, there was specific talk about
what you are expecting a bit ago and I can't remember the end discussion, it
may have even been on the dev list. I will see if I can
That is true, that is the correct behaviour, there was specific talk about
what you are expecting a bit ago and I can't remember the end discussion, it
may have even been on the dev list. I will see if I can come across it.
Ultimately, you can do:
var $selected = Array();
$('.selected').each(fun
Erik-
Nope I'm just looking for a way to stop the user from editing the
field. Setting it to readonly is good and the css will be a nice
visual cue.
Thanks.
On Aug 26, 11:19 pm, "Erik Beeson" <[EMAIL PROTECTED]> wrote:
> > Ajax validation. If it's validated then I need to disabled or hide
>
> Ajax validation. If it's validated then I need to disabled or hide
> it so the user can't edit it. Problem with disabled is that when the
> form is submitted disabled field doesn't get submitted.
You can make it read only, and maybe make the text gray so it's a
little clearer that it can't b
On 8/26/07, Minh <[EMAIL PROTECTED]> wrote:
>
> If it's validated then I need to disabled or hide
> it so the user can't edit it.
>
Try using the "readonly" attribute instead of disabling or hiding it, e.g.
$("#inputID").attr("readOnly", true).
But I have to ask: Why would you want to do this?
Stephan thanks for the explanations and Karl thanks for the
alternative solution.
Erik -
I have a form and after the user enter a value then it goes through
Ajax validation. If it's validated then I need to disabled or hide
it so the user can't edit it. Problem with disabled is that when the
f
Note that showing and hiding form fields (text fields, buttons, etc)
should be done with .show() and .hide() (that is, by changing the
display or visibility styles of the element), not by trying to change
the type property.
--Erik
On 8/26/07, Erik Beeson <[EMAIL PROTECTED]> wrote:
> Why would y
Actually another is to just hide it using CSS:
$("#inputID").hide();
Karl Rudd
On 8/27/07, Karl Rudd <[EMAIL PROTECTED]> wrote:
> It's a "quirk" of IE, nothing to do with jQuery. It doesn't allow you
> to change the "type" of an "input" element once it's created.
>
> The best you could do w
It's a "quirk" of IE, nothing to do with jQuery. It doesn't allow you
to change the "type" of an "input" element once it's created.
The best you could do would be to create a new "hidden" field and copy
across the contents of the visible element. Then delete the visible
element.
Karl Rudd
On 8/
On Aug 27, 5:49 am, Minh <[EMAIL PROTECTED]> wrote:
> Getting an error when I tried to set a input attribute to hidden in
> v1.1.2, v.1.1.3.1 and v1.1.4. Using $
> ("#inputID").attr({'type':'hidden'}) and $
> ("#inputID").attr("type","hidden").
Input elements are special cases in that their 'type
Why would you need to do that?
--Erik
On 8/26/07, Minh <[EMAIL PROTECTED]> wrote:
>
> Getting an error when I tried to set a input attribute to hidden in
> v1.1.2, v.1.1.3.1 and v1.1.4. Using $
> ("#inputID").attr({'type':'hidden'}) and $
> ("#inputID").attr("type","hidden").
>
>
You can also do: $('#Province').is('select')
-js
On 5/30/07, Gordon <[EMAIL PROTECTED]> wrote:
Selects don't have a type so returning undefined is the correct
behaviour. I'm assuming you either want to get the value of the
select or you want to identify the node type. If you want the value
Selects don't have a type so returning undefined is the correct
behaviour. I'm assuming you either want to get the value of the
select or you want to identify the node type. If you want the value
then you'd use attr ('value'). If you want to identify the element
node type things get a little tr
Erik Beeson wrote on 5/9/2007 2:39 AM:
Or maybe this was just a trivial example to illustrate an
inconsistency, in which case, ignore me.
No, that helped quite a bit to understand how to best utilize jQuery. Thank
you for the suggestions.
Either way, file a bug report
for it so it doesn'
Not sure about expected behavior, but the CSS version certainly seems
more correct to me. It could be shortened to:
$(".pics").css({borderStyle:"solid", borderWidth:"1px", borderColor:"white"});
Or really, in that specific case:
$(".pics").css("border", "1px solid white");
If you find yoursel
You don't even need to explicitly accumulate the result:
$.fn.attrs = function(key, val) {
if (val != undefined)
return this.attr(key, val);
return $.map(this, function(a) { return $(a).attr(key); });
};
Danny
malsup wrote:
>
> Good catch, Jörn!
>
>> You don't even need th
Good catch, Jörn!
You don't even need the explicit loop:
jQuery.fn.attrs = function(key, val) {
if (val != undefined)
return this.attr(key, val);
var a = [];
this.each(function() { a.push($(this).attr(key)); });
return a;
};
Mike Alsup schrieb:
That's just not what it does. Getter methods like that generally
return the value for the first matched element. If you want a plugin
to return all the values in an array you can write it like this
(untested):
jQuery.fn.attrs = function(key,val) {
if (val != undefined)
in jQuery operates on arrays. I guess I am looking for someone
to explain WHY the 'getter' functions operate this way from a design
perspective.
- Original Message
From: Mike Alsup <[EMAIL PROTECTED]>
To: jquery-en@googlegroups.com
Sent: Monday, April 30, 2007 8:20:54 PM
Su
thing else in jQuery operates on arrays. I guess I am looking for someone
to explain WHY the 'getter' functions operate this way from a design
perspective.
- Original Message
From: Mike Alsup <[EMAIL PROTECTED]>
To: jquery-en@googlegroups.com
Sent: Monday, April 30,
That's just not what it does. Getter methods like that generally
return the value for the first matched element. If you want a plugin
to return all the values in an array you can write it like this
(untested):
jQuery.fn.attrs = function(key,val) {
if (val != undefined)
return this.ea
Hi Michiel,
It sounds like you're able to access the attribute using something
like:
var myVal = document.getElementById('#inputBox').defaultValue; //
similar to the w3cschools example
This is a DOM attribute rather than an XHTML attribute - which is why
the attr method won't return the value.
You should file a net ticket for this. http://dev.jquery.com/newticket
--
Brandon Aaron
On 4/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Well i can get the defaultvalue by direct accessing it, but i wonder
why not via jquery. It's not very consistent to access all via the
attr and defa
Well i can get the defaultvalue by direct accessing it, but i wonder
why not via jquery. It's not very consistent to access all via the
attr and defaultValue direct and i don't like that.
W3schools says it's a w3c complaint attribute so i think it should be
accessible.
This is what they say : "Set
I think you want attr("value") for the value in the dom, vs ,val() for the
current contents.
defaultValue is a shortcut to get to the defined value from the html I
haven't used it but I have seen similar things with form items.
On 4/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Whil
1 - 100 of 101 matches
Mail list logo