再会,
我可以知道是否有可能/是否存在允许某些文本说带有 # 的 UIkit 是可点击的?
例如:
再会,
我可以知道是否有可能/是否存在允许某些文本说带有 # 的 UIkit 是可点击的?
例如:
Here is one method by which you can make some part of the content of a textarea clickable. Here we are not using a textarea. instead we use a div with contentEditable=true. Then we change the style of the div so that it looks like a text area. now with javascript you can replace the words inside the div with anchor tags..
<style type="text/css">
#editableDiv {
-moz-appearance: textfield;
-webkit-appearance: textfield;
background-color: white;
background-color: -moz-field;
border: 1px solid darkgray;
box-shadow: 1px 1px 1px 0 lightgray inset;
font: -moz-field;
font: -webkit-small-control;
margin-top: 5px;
padding: 2px 3px;
width: 398px;
}
</style>
<div id="editableDiv" contenteditable="true">This is a paragraph. It is editable. Try to change this #text. <a href="www.google.com">click here</a>
</div>
<button type="button" onclick="displayResult()">Click here to change the content</button>
<script>
function displayResult() {
var x = document.getElementById("editableDiv").innerHTML;
var m = x.replace("#text", "<a href ='#'>replaced text</a>");
document.getElementById("editableDiv").innerHTML = m;
}
</script>
In the above javascript code instead of #text you can use regular expressions also