Additional Div class options for jQuery
Set doctype in HTML5 and use custom data- * attributes .
<!DOCTYPE HTML>
...
<div class="photo" data-parameter1="custom" data-parameter2="custom" data-parameter3="custom" data-parameter4="custom"></div>
If you use HTML5, you have the option to create custom attributes with a prefixdata-* , which allows you to use something like
<div class="photo" data-parameter1="custom" data-parameter2="custom">...</div>
, sysntax , div
, w3c, .
var a=$('.photo').attr('parameter1');
var b=$('.photo').attr('parameter2');
var c=$('.photo').attr('parameter3');
var d=$('.photo').attr('parameter4');
and if you want to add new attributes using jquery, you can do it like this:
$('.photo').attr('newParameter','value');
Hope this works well for u
I think you disagree with some of the concepts in HTML.
Firstly, a div is not a "class", you have a "div element". A div element may have a class attribute.
Secondly, you should use </div>to close your element, not </class>.
For the problem, another solution is to use a hidden element inside your div, e.g.
<div class="photo">
<span class="hidden" name="parameter1">...</span>
<span class="hidden" name="parameter2">...</span>
<span class="hidden" name="parameter3">...</span>
<span class="hidden" name="parameter4">...</span>
</div>
with css style as follows:
.hidden {
display: none;
}
and finally jQuery for extracting values:
var value = $('div.photo span[name="parameter1"]').html();