Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Replacing Specific word from url, replacing url

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Set HREF for Anchor Tag</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
    $(document).ready(function(){
        $('a[href^="http://"]').each(function(){ 
            var oldUrl = $(this).attr("href"); // Get current url
            var newUrl = oldUrl.replace("http://", "https://"); // Create new url
            $(this).attr("href", newUrl); // Set herf value
        });
    });
</script>
</head>
<body>
    <p><a href="http://www.google.com">Google</a></p>
    <p><a href="http://www.gmail.com">Gmail</a></p>
</body> 
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: go back to screen with params react native 
Javascript :: add atribut readonly on form js 
Javascript :: poo javascript heritage 
Javascript :: helperbird 
Javascript :: how to check if we reach end of div react hooks 
Javascript :: multiple question node js 
Javascript :: jquery database add dropdown in datababe grid 
Javascript :: moment js get dd/mm/yyyy 
Javascript :: register js in viewyii2 
Javascript :: nodejs spawn detached command 
Javascript :: filewatcher nodejs 
Javascript :: javascript llenar array con objetos 
Javascript :: remove port number from url node js 
Javascript :: kitten ui input height multiline 
Javascript :: anonymous functions 
Javascript :: java script names starting with b foreach 
Javascript :: apollo client with functional component 
Javascript :: &lt;Link&gt; react import 
Javascript :: Foreach array in JavaScript fsd 
Javascript :: how to get value from a label in javascript gtk 
Javascript :: Javascript Class expressions 
Javascript :: find a big length friend from array javascript finding longest string in array in javascript 
Javascript :: AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal: 
Javascript :: javascirpt escape tab 
Javascript :: javascript camel case to words 
Javascript :: code to sum of specific nodes in binary tree for int kDistancefrom node(struct Tree,int k,int n); 
Javascript :: build an javascript URL and its search parameters 
Javascript :: on click disable esc button using jquery 
Javascript :: javascript responsive carousel 
Javascript :: react native red Half Circle bubble 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =