javascript - Using jQuery to load icon based on <label> contents -


I have a website where content is dynamically filled with a database, the content for each label is different

One can be prepared as a normal: while in the form of a TV:. My question is, is there any way that jQuery (depending on HTML output for label) can replace NAME: with font fonts?

For example:

  & lt; Label & gt; TV: & lt; / Labels & gt;  

will be:

  & lt; I class = "fa fa-film fa-2x" & gt; & Lt; / I & gt;  

Try

  var icons = {' TV: ':' movie ',' edit: ':' edit '}; Copy (). ToLowerCase (), icon = Icon [text]; Return icon? '& Lt; I class = "$" '(' label '). Replace (with function () {var text = $ (this) .text () FA FA-' + Icon + 'FA-2X' 'gt; & lt; / I & gt; ': undefined;})  
  & lt; script src = "https: / /ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js "> gt; & lt; / script & gt; link = rel =" stylesheet "type =" text / css " Href = "// cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.css"> Labels & gt; TV: & lt; / labels & gt; & Lt; label & gt; TSV: & lt; / label & gt; & lt; label & gt; Edit: & lt; / label & gt;  


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -