Here is my issue, i want to select an image and submit it using jquery, so i have diferent images, i select one and submit.
So my idea is when i click on some image in my LabBox, for example, 'images/dontlike_OFF.png', i create one select atribute ( $(this).attr('select', 'true');
and later, when i click on sendLabForm
i want to get the name of the image that i have clicked by using a selector $(#LabBox img[attribute=Value])
.
I believe this idea of creating an attribute is weird , but i really can see, on firebug, that attribute is really created, the problem is only when i want to get the name of that img with the selected attribute.
So, my question is: Why this is not possible? There is some way to get the name of the img that i have selected when i click on a submit button without using usual html forms?
<div id='LabBox'>
<img alt="dontlike" name="dlike" src="images/dontlike_OFF.png"/>
<img alt="check" name="check" src="images/check_OFF.png"/>
<img alt="funny" name="funny" src="images/funny_OFF.png"/>
<img alt="idea" name="gidea" src="images/idea_OFF.png"/>
<img alt="imp" name="imptt" src="images/imp_OFF.png"/>
</div>
<script type="text/javascript">
$("#LabBox img").click(function () {
$(this).attr('select', 'true');
});
$("#sendLabForm").click(function(){
console.log($("#LabBox img[select='true']").name);
});
</script>