Jump to content

JQ turn $('#topspeed').change(function() into a condition


makata
 Share

Recommended Posts

I want to replace $('#topspeed').change(function(){with a condition, something like if($("[id=topspeed]").....How to do it? Here's the HTML

<select id="topspeed" ><option data-icon="arrow-u" data-iconpos="top" >- SELECT -</option ></select>

Edited by makata
Link to comment
Share on other sites

What you're asking doesn't make sense unless maybe you mean something like this...

<script>$(document).ready(function(){  $("select").change(function(){    if(this.value=='SELECT1'){	  alert('SELECT1');    }else if (this.value=='SELECT2'){	  alert('SELECT2');    }else{	  alert('Other');    }  });});</script>

Edited by davej
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...