I’m trying to figure out if I can customize Unbounce to activate a website entry field like it does on our current home page (www.pearanalytics.com)). I’m working with an email field, but I need a URL field.
Hi Ryan,
I took a look at your page and noticed that the form you are using has a field in it that is still called “email” even though you are hiding the label and using it to collect URLs. I would suggest double clicking the form, selecting the input field and changing the name to “Url” so that your reporting will make a bit more sense. If you do this, the following script should do the trick for you…
Click the “Scripts” button, select ‘Head’ in the Placement dropdown menu, and paste in the following:
\<script type="text/javascript"\>
jQuery(function() {
var default\_val = "http://www.yourwebsite.com";
jQuery("inputrname='url']").val(default\_val)
.focus(function() {
if (jQuery(this).val() == default\_val) {
jQuery(this).val("")
}
}).blur(function() {
if (jQuery(this).val() == "") {
jQuery(this).val(default\_val)
}
});
});
\</script\>
As long as the field is properly named ‘url’ this will act similarly to your website. With a little more work you could add and remove a className in the ‘focus’ and ‘blur’ functions so that the text was gray instead of black. Let me know if it works!
Carter
Reply
Log in to the Unbounce Community
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.