I have a selectbox with month periods in it.
Here is my code:
$(function(){
$(\"#ppsub_ppterm_id\").change(function(){
chane '$' by jQuery for example:
$("#myId") -> jQuery("#myId")
It works
Make sure you're running your jQuery code after the document is loaded:
$(document).ready(function() { /* put your stuff here */ });
Also make sure you have no other controls with the id "ppsub_ppterm_id" on your HTML page.
Those are the first things I would check.
Even if jQuery couldn't find the element, it wouldn't be null - it would be an empty jQuery object.
Are you sure jQuery is loaded? Is it possible that another JavaScript library you're using is causing conflicts?
Sounds like JQuery isn't loading properly. Which source/version are you using?
Alternatively, it could be namespace collision, so try using jQuery
explicitly instead of $
. If that works, you may like to use noConflict to ensure the other code that's using $
doesn't break.
you have "ppsub_ppterm_id" as a class, name, id etc...
You need to pick ONE and select on it. There is no need for ID, NAME, CLASS to all have the same values.
You're probably confusing the hell out of jQuery.
<a id="ppsub_ppterm_id"> = $("#ppsub_ppterm_id")
<a class="ppsub_ppterm_id"> = $(".ppsub_ppterm_id")
<a name="ppsub_ppterm_id"> = $("*[name=ppsub_ppterm_id]")
Pick a way and go with it, but take out all those redundant attributes.