Using jQuery in JavaScript
var state = $('#btn-loc').attr('attrLoc');
Then you can send the value to PHP
EDIT:
If you are working with an HTML page / DOM in PHP, you can use SimpleXML to move the DOM and pull out your attributes this way
$xml = simplexml_load_string( '<div id="btn-loc" class="hidden" attrLoc="1"> ... </div>' ); foreach (current($xml->xpath('/*/div'))->attributes() as $k => $v) { var_dump($k,' : ',$v,'<br />'); }
You will see the name and value of the reset attributes
id : btn-loc class : hidden attrLoc : 1
source share