codescribblr
2/13/2014 - 9:41 PM

Javascript (jQuery) markup for saef in expression engine

Javascript (jQuery) markup for saef in expression engine

<script type="text/javascript">
// <![CDATA[
$(document).ready( function() {

//URL Title js
	$("input#title").keyup( function() {
		var titleText = $("input#title").val().replace(/ /g,"_").toLowerCase();
		$("input#url_title").val(titleText);
	});
	
//Safecracker File js
	$(".safecracker_file_undo_button").css("display", "none");
	$(".safecracker_file_remove_button").click( function() {
		$(".safecracker_file_input input").removeAttr("disabled");
		$(".safecracker_file_thumb").hide();
		$(".safecracker_file_undo_button").show();
		$(".safecracker_file_remove_button").hide();
		var value = $(".safecracker_file_hidden input").val();
		$(".safecracker_file_placeholder_input input").val(value);
		$(".safecracker_file_hidden input").val("NULL");
		return false;
		});
	$(".safecracker_file_undo_button").click( function() {
		$(".safecracker_file_input input").attr("disabled","disabled");
		$(".safecracker_file_thumb").show();
		$(".safecracker_file_undo_button").hide();
		$(".safecracker_file_remove_button").show();
		var value2 = $(".safecracker_file_placeholder_input input").val();
		$(".safecracker_file_hidden input").val(value2);
		$(".safecracker_file_placeholder_input input").val("NULL");
		;return false;
		});
});
// ]]>
</script>