Created
February 20, 2013 10:33
-
-
Save vabock/4994599 to your computer and use it in GitHub Desktop.
IDエスケープ
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>ID正規表現変換</title> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> | |
</head> | |
<body> | |
<div data-role="page"> | |
<div data-role="header"> | |
<h1>ID正規表現変換</h1> | |
</div><!-- /header --> | |
<div data-role="content"> | |
<label for="escid">ID:</label> <input name="escid" id="escid" value="" /> <br /> | |
<input type="button" name="escape_button" id="escape" value="変換" data-icon="plus"> | |
<script> | |
$("#escape").bind("click", function () { | |
$("#escid").val(function (idx, value) { | |
return "/" + value.replace(/([/.?*+^$[\]\\(){}|-])/g, "\\$1"); | |
}); | |
}); | |
</script> | |
</div><!-- /content --> | |
</div><!-- /page --> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment