I was wondering how I can do the following.
I would like to set a div containing a certain id with a specific attribute value. Then apply this id to a variable within a function, so that when I call the function it applies the id value.
<html>
<head></head>
<body>
<div id="1123123" value="idloader"> </div>
</body>
</html>
the string that is contained within the id should be set to variable within the function.
<script>
function setTheId() {
div.id.valueOf(id).hasAttribute([value="idloader"])
};
var XYZ = setTheId();
</script>
in conclusion the ( var XYZ = 1123123
) as set within the DOM element id with attribute value="idloader"
should equal to variable within function.
NOTE.. This is not the same as Find an element in DOM based on an attribute value since we are not trying to find an element within the DOM based on attribute but are setting the element with a specific string that can be stored to a variable within the script.