Solved

How to query attribute values using wildcards

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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 …

696 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