Get button href via Javascript
Description
The following code shows how to get button href via Javascript.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css">
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script type='text/javascript'>
$(window).load(function(){<!-- w w w.j a v a 2s. c o m-->
$(document).delegate('.button', 'click', function() {
alert($(this).attr('href'));
return false;
});
});
</script>
</head>
<body>
<a href="http://java2s.com"
class="button"
data-theme="c"
data-role="button"
data-iconpos="right"
data-icon="plus">Test</a>
</body>
</html>