Here is a link to a working fiddle, and here is the live page where it doesn’t work.
Once you click “click”, it should check to see if domain has a value and if not it dresses up a div as an error box. The “click” will become a button and there will be an input text box but as there is no domain the result should just be open dialog. Works in fiddle but not live code:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css" type="text/css" media="all" />
<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()
{
$( "#dialog" ).dialog(); // Shows the new alert box.
var domain_val = document.getElementsByName('domain');
if (domain_val[0].value.length > 0)
{
return true;
}
$( "#dialog" ).dialog();
return false;
}
</script>
jQuery doesn’t come with jQueryUI by default.
Include it.
http://www.jqueryui.com
EDIT: Comments below imply confusion.
In your jsFiddle, underneath the jQuery library selection on the left-hand panel, you have ticked ‘jquery ui’.
This is another javascript library, an extension of jQuery. You can download it at the above link.
It’s got default UI-skinning, which is the CSS file you have already included.
You will also need to include the jQueryUI script BELOW / AFTER jQuery.
EDIT: Just add this line after
<script src="js/jquery.js"></script><script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>