Skip to content

Instantly share code, notes, and snippets.

View noahub's full-sized avatar
💻
Doing computer stuff

Noah noahub

💻
Doing computer stuff
View GitHub Profile
@noahub
noahub / us_code.html
Created October 2, 2015 17:29
US State Code Value Map
<script>
lp.jQuery(function($){
// The dropdown's ID (without #)
var id = 'state';
// Map of old to new values
var values = {
@noahub
noahub / field_to_upper_case.html
Last active October 2, 2015 23:10
Field Values to Upper Case
<script>
//Replace #lp-pom-form-17 with your form's ID and 'email' with your field name.
//To convert field values to lower case, simply replace 'toUpperCase()' with 'toLowerCase()'
//To convert field values to Title Case, simply replace 'toUpperCase()' with 'replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});'
$("#lp-pom-form-17 input[name=email]").val(function () {
return this.value.toUpperCase();
})
</script>
//To execute the above function on form submit, use @johnnyopao's script like so:
@noahub
noahub / lb_redir.html
Last active October 7, 2015 16:24
Lightbox Main Page Redirect
<script>
window.top.location.href = "http://www.example.com";
</script>
@noahub
noahub / append_params_text.html
Created October 8, 2015 20:22
Append incoming parameters to text links on page
//The following script can be placed in the javascripts section of your page with placement 'Before Body End Tag'
<script>
$(function() {
$('.lp-pom-text a').not('a[href^=#]').each( function() {
this.href = this.href + window.location.search;
});
});
</script>
@noahub
noahub / button_click_value.html
Created November 5, 2015 19:02
Populate form field value based on different button clicks
//Update the button IDs (e.g. '#lp-pom-button-126') with your own button IDs, 'your_field_name' with your form's field name, and the value (e.g. 'Intro') with your own values.
<script type="text/javascript">
$(document).ready(function () {
$("#lp-pom-button-126").click(function(){
$("#lp-pom-form-363 input[name=your_field_name]").val("Intro");
});
@noahub
noahub / scroll_to_element.html
Created November 12, 2015 22:27
Scroll to Page Element on load
<script>
var element = document.getElementById("lp-pom-text-53"); //Replace with ID of your page element (Exclude the '#' sign)
element.scrollIntoView();
</script>
@noahub
noahub / cookie_to_form.html
Last active November 18, 2015 17:55
Pass Cookie Value to Form Field
@noahub
noahub / params_to_iframe.html
Last active December 22, 2015 19:44
Pass Incoming URL parameters to iframe
<script>
//Replace #frame1 with the ID of your iframe
$('#frame1').attr('src', (function() {
return $('#frame1').attr('src') + window.location.search;
})());
</script>
If iframe URL already has a query string, append parameters using script below
<script>
@noahub
noahub / updated-external-conversion-tracking
Created December 22, 2015 21:03 — forked from megub/updated-external-conversion-tracking
Updated External Conversion Tracking - to work with WP domains
<script type="text/javascript">
var _ubaq = _ubaq || [];
_ubaq.push(['trackGoal', 'convert']);
(function() {
function UnbounceAnalytics(commands) {
this.trackingUrl =
('https:' == document.location.protocol ? 'https://' : 'http://') +
"t.unbounce.com/trk"+"?";
this.commands = commands;
@noahub
noahub / conditional_fields.html
Created December 23, 2015 04:28
Conditional Form Field Visibility
<script>
$('#are_you_currently_running_ppc_Yes').click(function() {
$('#how_is_your_ppc_being_managed')[this.checked ? "show" : "hide"]("slow");
});
</script>
and
<style>
#how_is_your_ppc_being_managed {display:none;}