Solved

JQuery Syntax

Posted on 2015-02-14
1
28 Views
Last Modified: 2015-03-03
In JQuery, is there a way to write, "IF a Select Name Contains"?

I have the following:
var deduc = $('select[name="item_options[product_deductible]"]').val();

I would like to have:
var deduc = $('select[name="IF NAME CONTAINS - product_deductible"]').val();
0
Comment
Question by:rgranlund
1 Comment
 
LVL 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 40610041
use the wildcard (*) character in the selector:

$("[name*='product_deductible']")

Open in new window


Obviously if you use this, it may match more than one element and only return the first, so consider that when you design your app.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to dynamically set the form action using jQuery.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now