?
Solved

if contains "xxxx" show row

Posted on 2010-11-24
4
Medium Priority
?
406 Views
Last Modified: 2012-08-13
I am using the below code to show or hide a table row based a list menu value being 1 or 11.

<script language="javascript">
      $("document").ready(function() {
             $('#ink_brand_id').bind('change',function(){
                  if( this.selectedIndex > -1  && this.options[this.selectedIndex].value==1 || this.options[this.selectedIndex].value==11)
                        $(".captionRow").show();
                  else
                        $(".captionRow").hide();
            });
            $('#ink_brand_id').change();
      });
</script>

How do I change it show the table row shows if the list menu contains the words "Colorific" or "Elements"?
0
Comment
Question by:petewinter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 10

Expert Comment

by:hosneylk
ID: 34203847

if( this.selectedIndex > -1  && this.options[this.selectedIndex].value.indexOf('Colorific') >= 0 || this.options[this.selectedIndex].value.indexOf('Elements') >= 0)

Open in new window

0
 
LVL 10

Accepted Solution

by:
hosneylk earned 2000 total points
ID: 34203853
sorry. value should be text.
if( this.selectedIndex > -1  && this.options[this.selectedIndex].text.indexOf('Colorific') >= 0 || this.options[this.selectedIndex].text.indexOf('Elements') >= 0)

Open in new window

0
 
LVL 10

Expert Comment

by:hosneylk
ID: 34203900
you can also do this
if( this.selectedIndex > -1  && this.options[this.selectedIndex].text.search(/Colorific|Elements/) >= 0)

Open in new window

0
 

Author Closing Comment

by:petewinter
ID: 34204017
Perfect. Many thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question