Last active
August 29, 2015 14:02
-
-
Save skipjac/d64465c50f15d1822b0d to your computer and use it in GitHub Desktop.
Set default dropdown values in Zendesk Help Center. This is just the code to set the actual value.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="form-field string required request_custom_fields_21631456"> | |
<label for="request_custom_fields_21631456">fav</label> | |
<input autocomplete="off" data-tagger=data-tagger="{"-":{"id":"","title":"-","selected":true},"pet":{"cat":{"id":"cat","title":"pet::cat"},"dog":{"id":"dog","title":"pet::dog"}},"Dolphin":{"id":"dolphin","title":"Dolphin"},"the fish":{"id":"the_fish","title":"the fish"}}" id="request_custom_fields_21631456" name="request[custom_fields][21631456]" size="0" type="hidden" value=""> | |
<a class="nesty-input" tabindex="0">-</a> | |
</div> | |
<script> | |
//in order to set the value of the field and make it visible set the input value and anchor text | |
//so this will set the field fav to The fish | |
$('.request_custom_fields_21631456').one('DOMNodeInserted', function(d){ | |
console.log(d); | |
$(d.currentTarget).val('the_fish'); | |
$(d.target).text('The Fish'); | |
}); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment