I was wondering whether or not jQuery supports HTML5 elements.
For example, I tried this code but it fails with a rather weird error:
$('<progress value="2">').val();
It says:
TypeError: Object 1 has no method 'replace'
Is jQuery to support HTML5 elements in the future, or am I doing something wrong this way?
EDIT: It does not seem to be the selector: /
I was wondering whether or not jQuery supports HTML5 elements.
For example, I tried this code but it fails with a rather weird error:
$('<progress value="2">').val();
It says:
TypeError: Object 1 has no method 'replace'
Is jQuery to support HTML5 elements in the future, or am I doing something wrong this way?
EDIT: It does not seem to be the selector: http://jsfiddle/z5t3g/
Share Improve this question edited Feb 1, 2015 at 16:30 Deduplicator 45.8k7 gold badges72 silver badges123 bronze badges asked Feb 24, 2011 at 20:56 pimvdbpimvdb 155k80 gold badges311 silver badges356 bronze badges 2- 1 you have to reference html elements like $('progress'), i think you can then select based on the value as well. – jonezy Commented Feb 24, 2011 at 20:57
-
Appreantly, using HTML for the element and then accessing it with
$('#progress')
doesn't work either: jsfiddle/z5t3g. – pimvdb Commented Feb 24, 2011 at 21:02
4 Answers
Reset to default 2If you have your <progress />
element in the DOM:
<progress value="2" />
You can select it using jQuery, but it seems that (as of version 1.5) it doesn't know to return the value
attribute using the .val()
method. You need to check the attribute by name:
$('progress').attr('value');
Use a jquery selector for it
$("progress").val();
try this:
$('#progress').val();
You'll want to do this
$('progress[value=="2"]).val();
You can't select using the entire tag with jQuery.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745378667a4625121.html
评论列表(0条)