Created
January 26, 2012 15:54
-
-
Save niwaringo/1683438 to your computer and use it in GitHub Desktop.
jQuery Plugin fhconvert old ver
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
(function($) { | |
$.fn.fhconvert = function(type, options) { | |
var settings = $.extend({ | |
'jaCode':true, | |
'space':true, | |
'convSet':'object' | |
}, options); | |
$(this).each(function() { | |
var $this = $(this); | |
var convertText = FHConvert[type]($this.val(), settings); | |
$this.val(convertText); | |
}); | |
return this; | |
}; | |
}(jQuery)); |
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
フォーカスが外れると全角になる。 | |
<input id="zenkaku" type="text" /> | |
<br /> | |
フォーカスが外れると半角になる。 | |
<input id="hankaku" type="text" /> | |
<br /> | |
フォーカスが外れるとカナになる。 | |
<input id="kana" type="text" /> | |
<script type="text/javascript"> | |
$(function() { | |
$('#zenkaku').blur(function() { | |
$(this).fhconvert('htof'); | |
}); | |
$('#hankaku').blur(function() { | |
$(this).fhconvert('ftoh'); | |
}); | |
$('#kana').blur(function() { | |
$(this).fhconvert('hgtokk'); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment