Solved

How to query attribute values using wildcards

Posted on 2009-07-02
2
889 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

706 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

21 Experts available now in Live!

Get 1:1 Help Now