Skip to content

Commit

Permalink
Create gw-auto-prepend-https.js
Browse files Browse the repository at this point in the history
  • Loading branch information
spivurno authored Mar 10, 2022
1 parent 13a0a0e commit a196f8a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions experimental/gw-auto-prepend-https.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Gravity Wiz // Gravity Forms // Auto-prepend HTTPS to URLs
* https://gravitywiz.com/
*
* Auto-prepend "https://" to URLs in Website fields.
*/
// Update "1" to your field ID.
$( '#input_GFFORMID_1' )
.on( 'focus', function() {
if ( $( this ).val() === '' ) {
$( this ).val( 'https://' );
}
} )
.on( 'keyup', function() {
if ( $( this ).val() === 'https:/' ) {
$( this ).val( 'https://' );
} else if ( $( this ).val().indexOf( 'https://' ) !== 0 ) {
$( this ).val( 'https://' + $( this ).val() );
}
} );

0 comments on commit a196f8a

Please sign in to comment.