Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to get href value of anchor tag in jquery in list

<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);    
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: node js variables in string 
Javascript :: javascript check if array has duplicate values 
Javascript :: redux devtools chrome 
Javascript :: how to use static files in express with ejs 
Javascript :: how to get element of an array in javascript 
Javascript :: javascript random integer 
Javascript :: Program for factorial of a number in javascript 
Javascript :: how to serialize form data in js 
Javascript :: how to set html label value in jquery 
Javascript :: convert moment info to dd mmm yyyy 
Javascript :: capitalize first letter after character javascript 
Javascript :: js addeventlistener hover 
Javascript :: placeholder javascript 
Javascript :: avascript sum of arguments 
Javascript :: regex one or more words 
Javascript :: get html input value by class name 
Javascript :: slick slider multiple sliders on one page 
Javascript :: get url in js 
Javascript :: discord delete messag 
Javascript :: js window.confirm 
Javascript :: react run useeffect only once 
Javascript :: split sentence in array js 
Javascript :: cdn react 
Javascript :: jquery offsetheight 
Javascript :: remove element from array in js 
Javascript :: Disable Initial Sorting in Datatable 
Javascript :: package.json set environment variables 
Javascript :: javascript get now date yyyy-mm-dd 
Javascript :: anonymous function jquery 
Javascript :: create react portal 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =