Solved

How to query attribute values using wildcards

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

Technology Partners: 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

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

730 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