How would I write the following code to jQuery?
$("select").change(function(){
if($("#selectedid").is(":selected")){
$("#showblock").slideDown("slow");
} else { $("#showblock").slideUp("slow"); }
});
I also tried the following:
jQuery("select").change(function($){
if($("#selectedid").is(":selected")){
$("#showblock").slideDown("slow");
} else { $("#showblock").slideUp("slow"); }
});
It's for wordpress. Thanks!
In wordpress you'll probably get errors because wordpress includes a version of jquery that is editted to not use the '$' operator
you have to replace every instance of the '$' with jQuery
so your code should look like this;
jQuery("select").change(function(){
if(jQuery("#selectedid").is(":selected")){
jQuery("#showblock").slideDown("slow");
} else {
jQuery("#showblock").slideUp("slow");
}
});
try that and tell me how it works for you.
an easier way would be just to include a standard (downloaded) version of jquery and include it in your header.php