find and mark word in html string [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 days ago.
Improve this question
I need to search for a word in html text. But html tags should not be searched. For example, I am looking for the word a in the text below, and the <a> tag should not be mistakenly searched for.
<div class="card-body">
<h5 class="card-title text-primary">ramin </h5>
<p class="card-text"></p>
<p dir="RTL" style="text-align:justify">this is a book</p>
<p dir="RTL" style="text-align:justify">
<strong>یادآوری</strong>-
<a class="btnbandmodal" href="" data-bs-toggle="modal" data-bs-target="#bandmodal" data-bandid="پیوست الف" data-baznegari="1390"> aaaa</a>
this is a book.
</p>
<p></p>
<hr class="bg-danger border-2 border-top border-warning">
</div>

Related

cant remove underline from <p> [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 9 months ago.
Improve this question
I tried many solutions to remove the text-decoration from p but without any progress.
The HTML looks like this
<div class="container-fluid my-container align-items-center">
<div class="row my-row">
<div class="col-md-3 ">
</div>
<div class="col-md-9 ">
<div class="thumbnail d-flex justify-content-center imagePreview">
<a href="#############" target="_blank">
<img src="../assets/img/thumbnails/Apelles_230x177cm_2020__.jpg" alt="" style="width:400px;">
<div class="caption">
<!--########### Here is the p-->
<p id="captionStyle">Apelles<br>2020</p>
</div>
</a>
</div>
Browsers automatically add underscores to links for accessibility. To clear it, you can use reset.css or write this snippet:
a { text-decoration: none }
P.S. You can search CSS Reset, Normalize, and browser styles for more information.

How to link list in vue [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
<template>
<div class="lists">
<div v-for="(list, key, i) in getAllBreeds" :key="i">
<div v-if="list.length">
<div v-for="(ele,i) in list" :key="i" class="listOption">
<router-link :to="/breed/:key/:ele">
{{ele}} {{key}}
</router-link>
</div>
</div>
<div v-else class="listOption">
<router-link :to="/breed/:key/images">
{{key}}
</router-link>
</div>
</div>
</div
</template>
I am using Vue Router. I read a lot of articles and all but still I coudn't understand anything from them.
The reason the links are going to localhost:8080/breed/:key/:ele is because you are not interpolating the values. That shorthand is only for setting attributes on elements. You'd want to change your router-link to look something like this:
<router-link :to="`/breed/${key}/${ele}`">
{{ele}} {{key}}
</router-link>

How to get JSON text to HTML? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
How Can I add these JSON values to text field in HTML.
JSON:
"data": [
{
"zamestnanci": "3",
"konvoje": "0",
"pozice": "1533",
"kilometry": "5445"
}]}
I need add these 4 values to these 4 text fields:
<div class="counter-item">
<h2>here value 1</h2>
<h6>Odjeté konvoje</h6>
</div>
<div class="counter-item">
<h2>here value 2</h2>
<h6>Odjeté konvoje</h6>
</div>
<div class="counter-item">
<h2>here value 3</h2>
<h6>Pozice</h6>
</div>
<div class="counter-item">
<h2>here value 4</h2>
<h6>Najeté kilometry</h6>
</div>
You can use jQuery to select h2 child in class counter-item, and assign value to it.
Please refer below CodingGround URL:
http://tpcg.io/MFiJda

Proper way of using the same button in multiple contextes [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Say I implement a small webbased game with JavaScript:
When game over, a menu pops up with multiple buttons. One button returns the player to the main menu.
The same button shall appear when I interrupt the game.
<div class="menu gameOverMenu" style="display: none;">
<button class="menuButton" type="button" id ="playAgain">
Play again
</button>
<button class="menuButton" type="button" id ="toMainMenu1">
Main Menu
</button>
</div>
<div class="menu pauseMenu" style="display: none;">
<button class="menuButton" type="button" id ="continue">
Continue
</button>
<button class="menuButton" type="button" id ="toMainMenu2">
Main Menu
</button>
</div>
and handle the button event to return to the main menu via jQuery:
$('#toMainMenu1, #toMainMenu2' ).on('click', function(){
switchUi("main");
})
I don't want to use the same id again and creating a similar button with an other ID as I did does not feel right. Should I create the button with the display: none; property once in my markup and clone it into my different menus? Create a class for these two buttons? Or is there an easier and better way to do so?
I hope I follow the SO rules of posting, this is my first time asking for help.
This is an option:
<div class="menu" style="display: none;">
<div class="gameOverMenu" style="display: none;">
<button class="menuButton" type="button" id ="playAgain">Play again</button>
</div>
<div class="pauseMenu" style="display: none;">
<button class="menuButton" type="button" id ="continue">Continue</button>
</div>
<button class="menuButton" type="button" id="toMainMenu">Main Menu</button>
</div>
or do not use ID toMainMenu1 and 2 but use a class nagivateToMainMenu and use that in your jQuery $("button.nagivateToMainMenu").on("click", function(){ switchUi("main"); }); etc.
<button class="menuButton nagivateToMainMenu" type="button" id="toMainMenu3000">Main Menu</button>

.index() only for one instance of class [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I've got a problem with .index() function in jQuery.
Outline of DOM:
<div class="one">
<div class="two">
<div class="three"></div>
<div class="three"></div>
<div class="three"></div>
</div>
<div class="threeB"></div>
<div class="threeB"></div>
<div class="threeB"></div>
</div>
<div class="one">
<div class="two">
<div class="three"></div>
<div class="three"></div>
</div>
<div class="threeB"></div>
<div class="threeB"></div>
</div>
<div class="one">
<div class="two">
<div class="three"></div>
<div class="three"></div>
<div class="three"></div>
</div>
<div class="threeB"></div>
<div class="threeB"></div>
<div class="threeB"></div>
</div>
According to which of threes in two a user clicks, one of the threeBs are displayed. I wanted to do this with .index() function, but it fails for all but the first ones. In the second one class, the two threes have indexes 3 and 4 (instead of desired 0 and 1). On the other hand, .eq() for threeBs seems to work as desired.
Any neat way to solve this without having to count how many threes were there before the div in question?
It is working like this:
$('.three').click(function(){
$(this).parent().parent().find('.threeB').eq($(this).index())
.css('background','green');
});
Check here: jsFiddle

Categories