Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jQuery select default item in select  RSS feed

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know it possible to set the default, but is it possible to do it dynamically? I'm trying to set a date drop down for today's date.



This doesn't work because of the variable in the code. Any advice? The following works but its not dynamic.
 
Author and ninkuma
Marshal
Posts: 66678
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If all you need to do is to embed the value of m in the selector, then simple JavaScript string concatenation will suffice:
 
Willie Smits can speak 40 languages. This tiny ad can speak only one:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!