I am newbie to jQuery.
In netbeans I have jquery-1.7.2.js where all HTML files are present. I am creating JSF 2.0 project.
Below is the code I have
<?xml version='1.0' encoding='UTF-8' ?>
<!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"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
<h:head>
<title>Welcome to MySite.</title>
</h:head>
<script language="text/javascript" src="#{facesContext.externalContext.requestContextPath}/faces/jquery-1.7.2.js"></script>
<script type="text/javascript">
$(document).ready(function() {
alert('I am here...');
$("#table tr:last").after("<tr><td>some</td><td>content</td></tr>");
});
</script>
I believe with this code, whenever document gets loaded, I should have got alert as Hi, I am here... however I am not getting any alert.
Also, when I see view source & click on jquery-1.7.2.js, it gets opened.
Any idea why I am not getting alert?
Update 1
I am following tutorial provided here, still no luck. :(
<script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>