Hi,
I'm trying to use JQuery. I read Telerik documentation about this and I want to make a sample:
It's OK. But I don't want to have javascript inside body element so I moved javascript to head section of my site:
And now there is an error:
http://img229.imageshack.us/img229/1006/telerikjquerybug.jpg ('$telerik' is undefined).
Is it the proper behaviour? I want to put all javascript code into seperate file and include with sigle line:
I'm trying to use JQuery. I read Telerik documentation about this and I want to make a sample:
<telerik:RadScriptManager runat="server" ID="RadScriptManager1"> |
</telerik:RadScriptManager> |
<telerik:RadComboBox runat="server" ID="RadComboBox1" Width="300px" Skin="Telerik"> |
<Items> |
<telerik:RadComboBoxItem Text="ASP.NET AJAX UI Controls" /> |
<telerik:RadComboBoxItem Text="WinForms UI Controls" /> |
<telerik:RadComboBoxItem Text="WPF UI Controls" /> |
<telerik:RadComboBoxItem Text="Silverlight UI Controls" /> |
<telerik:RadComboBoxItem Text="Telerik Reporting" /> |
<telerik:RadComboBoxItem Text="Telerik OpenAccess ORM" /> |
<telerik:RadComboBoxItem Text="Telerik Sitefinity CMS" /> |
</Items> |
</telerik:RadComboBox> |
<script type="text/javascript"> |
(function($) { |
$(document).ready(function() { |
$('.rcbItem') |
.mouseover(function() { |
$(this).stop().animate({ paddingLeft: "30px" }, { duration: 300 }); |
}) |
.mouseout(function() { |
$(this).stop().animate({ paddingLeft: "4px" }, { duration: 300 }); |
}); |
}); |
})($telerik.$); |
</script> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title></title> |
<script type="text/javascript"> |
(function($) { |
$(document).ready(function() { |
$('.rcbItem') |
.mouseover(function() { |
$(this).stop().animate({ paddingLeft: "30px" }, { duration: 300 }); |
}) |
.mouseout(function() { |
$(this).stop().animate({ paddingLeft: "4px" }, { duration: 300 }); |
}); |
}); |
})($telerik.$); |
</script> |
</head> |
<body> |
<form id="form1" runat="server"> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
</telerik:RadScriptManager> |
<div> |
<telerik:RadComboBox runat="server" ID="RadComboBox1" Width="300px" Skin="Telerik"> |
<Items> |
<telerik:RadComboBoxItem Text="ASP.NET AJAX UI Controls" /> |
<telerik:RadComboBoxItem Text="WinForms UI Controls" /> |
<telerik:RadComboBoxItem Text="WPF UI Controls" /> |
<telerik:RadComboBoxItem Text="Silverlight UI Controls" /> |
<telerik:RadComboBoxItem Text="Telerik Reporting" /> |
<telerik:RadComboBoxItem Text="Telerik OpenAccess ORM" /> |
<telerik:RadComboBoxItem Text="Telerik Sitefinity CMS" /> |
</Items> |
</telerik:RadComboBox> |
</div> |
</form> |
</body> |
</html> |
And now there is an error:
http://img229.imageshack.us/img229/1006/telerikjquerybug.jpg ('$telerik' is undefined).
Is it the proper behaviour? I want to put all javascript code into seperate file and include with sigle line:
<script type="text/javascript" src="file.js"> |
What do I wrong?