How can you logically group HTML elements without taking the help of CSS classes ?
Posted
by
Perpetualcoder
on Stack Overflow
See other posts from Stack Overflow
or by Perpetualcoder
Published on 2010-12-24T18:30:24Z
Indexed on
2010/12/24
18:54 UTC
Read the original article
Hit count: 258
JavaScript
|html
I know that in jQuery you can use something like $(".cssClass") to get all elements with this class. However in plain html and javascript how do you group elements logically? For example:
<input id="fee1" data-id="1" data-group="Fees" type="text" value="$15.00"/>
<input id="fee2" data-id="2" data-group="Fees" type="text" value="$25.00"/>
<input id="fee3" data-id="3" data-group="Fees" type="text" value="$35.00"/>
I want to create a javascript function like this:
function GetByDataGroup(dataGroup){
/* returns something like [[1,"$15.00"],[2,"$25.00"],[3,"$35.00"]]*/
}
EDIT : Due to some political reasons I cant use jQuery or any framework..i know it doesnt make sense :)
© Stack Overflow or respective owner