Answers for "jquery attribute value"

2

get attribute value jquery href

var href = $(this).attr('href');
Posted by: Guest on April-27-2020
8

get attribute value jquery

var some_var = $( some_jquery_selector ).attr( 'some_attribute_name' );
Posted by: Guest on March-20-2020
0

jQuery( "[attribute|='value']" )

/* Description: Selects elements that 
have the specified attribute with a value either equal to a given string or
starting with that string followed by a hyphen (-). */
<body>
 
<a href="example.html" hreflang="en">Some text</a> <!-- will select this -->
<a href="example.html" hreflang="en-UK">Some other text</a> <!-- will select this -->
<a href="example.html" hreflang="english">will not be outlined</a> <!-- not this -->
 
<script>
$( "a[hreflang|='en']" ).css( "border", "3px dotted green" );
</script>
 
</body>
</html>
Posted by: Guest on August-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language