Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Offline
#26 2010-02-07 11:49:53
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: how do I display one link from a link id entered in custom field?
now?
$(document).ready(function() {
$('a[rel="external"]').each(function() {
$(this).attr('target', '_blank');
});
});
Offline
#27 2010-02-08 14:25:23
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: how do I display one link from a link id entered in custom field?
the above is absolutely correct code, isn’t it?
to open the links with rel=“external” attribute in new window, isn’t it?
but it just not working in this page with jquery-1.4.1.min.js i’m using
Offline
Re: how do I display one link from a link id entered in custom field?
Gallex,
the problem is you are also using another JS library (Prototype) and so, there is a conflict between jQuery and Prototype.
It’s easily fixable using jQuery.noConflict(). Read more here: Using_jQuery_with_Other_Libraries
Offline
Re: how do I display one link from a link id entered in custom field?
like maniqui mentioned, you are using 2 libraries, both react to the selector $
you properly could go with this
<script type=“text/javascript”>
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery(‘a[rel=“external”]’).each(function() {
jQuery(this).attr(‘target’, ‘_blank’);
});
});
</script>
jQuery.noConflict(); releases the $ selector, so each jQuery command you write has to begin with jQuery instead of the fancy $
the $ is then again available for the prototype library.
Offline
#30 2010-02-09 11:01:18
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: how do I display one link from a link id entered in custom field?
at last…thank’s maniqui for pointing the problem reason
Offline