Reputation: 170
i have a basic jquery and html code, when i paste in in JSfiddle and select the library "jquery-ui-1.9.2.min.js" it works. But when i dont select a library, but link a script from my server it doesn't work...
I checked the request, and the server gave an answer with the correct library...
<script type="text/javascript">
$(document).ready(function () {
$('#NewCustomerDiv input[name="companyname"]').keyup(function () {
if ($(this).val() == "") {
$('#CustomerCompanyDiv').slideUp("slow");
} else {
$('#CustomerCompanyDiv').slideDown("slow");
}
});
if ($('#NewCustomerDiv input[name="companyname"]').val()) {
$('#CustomerCompanyDiv').slideUp("slow");
}
$(".compname").click(function () {
$(this).select();
});
});
</script>
<div id="NewCustomerDiv" <tr>
<td class="fieldlabel field0a">Bedrijfsnaam</td>
<td class="fieldlabel field0b" colspan="3">
<input type="text" name="companyname" tabindex="3" style="width:80%;" />
<p style="margin-left:50px; display:inline;">Indien van toepassing</p>
</td>
</tr>
<div id="CustomerCompanyDiv" style="display:none;">
<input type="text" name="veld1" />
<input type="text" name="veld2" />
</div>
</div>
Here's the jsfiddle
Upvotes: 1
Views: 82
Reputation: 4917
You didn't close the first <div>
and forget the <table>
tag
HTML
<div id="NewCustomerDiv">
<table>
<tr>
<td class="fieldlabel field0a">Bedrijfsnaam</td>
<td class="fieldlabel field0b" colspan="3">
<input type="text" name="companyname" tabindex="3" style="width:80%;" />
<p style="margin-left:50px; display:inline;">Indien van toepassing</p>
</td>
</tr>
</table>
<div id="CustomerCompanyDiv" style="display:none;">
<input type="text" name="veld1" />
<input type="text" name="veld2"/>
</div>
</div>
JAVASCRIPT
$(document).ready(function(){
$('#NewCustomerDiv input[name="companyname"]').keyup(function(){
if($(this).val()==""){
$('#CustomerCompanyDiv').slideUp("slow");
}
else{
$('#CustomerCompanyDiv').slideDown("slow");
}
});
if($('#NewCustomerDiv input[name="companyname"]').val()){
$('#CustomerCompanyDiv').slideUp("slow");
}
$(".compname").click(function(){
$(this).select();
});
});
Upvotes: 1