how to get href value of anchor tag in jquery
<div class="getval">
<a href="https://wlearnsmart.com/">W learn Smart</a>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.getval a').click(function() {
event.preventDefault();
var get = $(this).attr('href');
alert(get);
console.log(get);
});
});<ul class="sub_menu">
<li><a href="caps">Caps</a></li>
<li><a href="jeans">Jeans</a></li>
<li><a href="shorts">Shorts</a></li>
<li><a href="foootwear">Footwear</a></li>
</ul>
$('ul.sub_menu li a').click(function() {
event.preventDefault();
var txt = $(this).attr('href');
alert(txt);
});$("#mylink").attr("href");
Also in JavaScript:
- react detect enter key
- javascript string contains character
- javascript convert string to bool
- javascript exercism.io bob solution
- (node:14372) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGHUP listeners added to [process]. Use emitter.setMaxListeners() to increase limit
- select class with data attribute jquery
- jquery from object to queryselector
- reactnode prop-types
- reactstrap search bar
- convert csv to json python
- check if type is blob javascript
- vscode new file shortcut
- denuncia perturbação
- js find duplicates in array
- laravel return response json
- javacript detect undefined
- port 3000 is already in use nodemon app crashed
- escape json in javascript
- geolocation speed
- decrease touchableopacity in react native
- reach to each cell in 2d array javascript
- terminal tree command
- viewdata array mvc razor javascript
- react not recognizing lorem