Solved

How to query attribute values using wildcards

Posted on 2009-07-02
2
890 Views
Last Modified: 2013-11-19
I'm creating a web site that conforms to xhtml 1.1, which excludes the use of the "target" attribute. Instead I'm using rel="external" and the attached jQuery script to open links in new windows.

The script works well, with the exceptions where I also use the "rel" attribute to tag content with the XFN micro format, i.e: rel="external me". In this case the attached script won't match the attribute, since it's not an exact match.

Is there a way in jQuery where I can match attribute values with a wildcard?

The site in question: http://www.fjær.no
$(document).ready( function() {

    

    $('A[rel="external"]').click( function() {

        window.open( $(this).attr('href') );

        return false;

    });

    

});

Open in new window

0
Comment
Question by:havard-fjaer
2 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 24762649
something like

A[rel*=external]


0
 
LVL 2

Author Closing Comment

by:havard-fjaer
ID: 31599126
Worked perfectly!
Thank you!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Tool to Build Android and iOS App 3 54
Form with Modals 16 44
how can i get a 4  at the second console.log? 6 33
Capture logon name 13 37
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

920 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

14 Experts available now in Live!

Get 1:1 Help Now