Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by bongii
at 2024-08-09 05:00:19
Point:500 Replies:5 POST_ID:828726USER_ID:11614
Topic:
jQuery;;
Hi.
I have 2 links, but I only want the jquery script to work at all links who contains the word shop in the url.
<a target="_blank" href="untitled1.html">start</a>
<a target="_blank" href="shop/untitled1.html"></a>
My jQuery seems like:
$(document).ready(function(){
$('a[target="_blank"]').removeAttr('target');
});
I know I kan make a loop through all links on the page, but it will be slow. Can the jquery be changed to look like:
$('a[target="_blank"]').removeAttr('target').OnlyWhenLinkContains("shop") ; :)
I have 2 links, but I only want the jquery script to work at all links who contains the word shop in the url.
<a target="_blank" href="untitled1.html">start</a>
<a target="_blank" href="shop/untitled1.html"></a>
My jQuery seems like:
$(document).ready(function(){
$('a[target="_blank"]').removeAttr('target');
});
I know I kan make a loop through all links on the page, but it will be slow. Can the jquery be changed to look like:
$('a[target="_blank"]').removeAttr('target').OnlyWhenLinkContains("shop") ; :)
Author: bongii replied at 2024-08-12 00:36:58
Thanks :)
Expert: duncanb7 replied at 2024-08-09 05:30:26
it is correct from Tomarse111 with $('a[href*="shop"]').removeAttr('target')
"not using $('a[target="_blank"]').removeAttr('target').OnlyWhenLinkContains("shop") ;"
Talk you later, have nice day
Duncan
"not using $('a[target="_blank"]').removeAttr('target').OnlyWhenLinkContains("shop") ;"
Talk you later, have nice day
Duncan
Accepted Solution
Expert: Tomarse111 replied at 2024-08-09 05:25:57
500 points EXCELLENT
duncanb nearly had it :)
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/javascript"> $(function(){ $('a[href*="shop"]').removeAttr('target') })</script><a target="_blank" href="untitled1.html">start</a><a target="_blank" href="shop/untitled1.html">shop</a> 1:2:3:4:5:6:7:8:9:10:
Expert: duncanb7 replied at 2024-08-09 05:16:03
$( "a[href.indexOf('shop')>=0]" ).removeAttr('target')
It might works, please try this
It might works, please try this
Expert: duncanb7 replied at 2024-08-09 05:02:06
You have to do a for loop I think, why you said it is slow, just a little code ?