これがどれほど柔軟かを見ようとしています。http://jsfiddle.net/PJSha/4/ get要素をNameからClassNameに変更しました。どちらも機能しましたが、Idで達成しようとすると機能しません...理由があります
コード:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css" type="text/css" media="all" />
<input type="text" id="foo" class="bar" name="domain">
<div onclick="check_domain_input()">Click</div>
<div id="dialog" title="Attention!" style="display:none">
Please enter a domain name to search for.
</div>
<script>
function check_domain_input() {
var domain_val = document.getElementById('foo');
if (domain_val[0].value.length > 0) {
return true;
}
$( "#dialog" ).dialog();
return false;
}
</script>