Javascript/Jquery Using Regex (or not) to add <span> to vowels -
Coding needs new and need some help.
Currently, my code output numbers from 1-99, then display some text next to the number, depending on the circumstances, for example 3 is divisible by 3 which is 'java', divisible 'script' from 5 And if they are both then it displays 'javascript'.
My goal now when the user clicks on a vowel, it will pop up a number reporter with the vowel. Example A = 0, E = 1, I = 2, O = 3 and U = 4 So when click on any sheet on the page, a pop up 0 will be displayed in it.
I have succeeded in using regex (I believe), to take out the letter and change it with 44 to see if it was working. The best solution from my research is putting these vowels in one period and then put a mouseclick on it. I'm not sure how to do this, how do I find vowels and put an A / E / I / O / U around it?
Any assistance will be highly appreciated. Thanks All
" + i + "& lt; span class = 'foo' & gt;" + str + "& lt; / span & gt; & lt; / p & gt; Var vowela = / a / gi; var newvowela = straeiou.replace Vowela, "44"); document.write (newvowela);} function num () {for (var i = 1; i & lt; 100; i ++ ) {If (i% 3 == 0 and amp; i% 5 = = (0) ($ ('# demo')) ($ ('' demo '') .adend (IT, "javascript")); And if (i% 3 == 0) {$ ('# demo') .andend (getContent (i, "java"))} and if (i% 5 == 0) {$ ('# demo') . that (GetContent (i, "script"))} and {$ ('# demo'). (GetContent (i, ""));}}} num (); // $ ('aou'). (Function () {// alert ('click');}};} ()); < First of all, if you code is very chaotic and is currently broken. You return the getContent ()
function by using the .append ()
method of jQuery, but currently getContent ( )
does not return anything
instead you use document.write
which overwrites the entire contents of the page. In the beginning you should forget that document.write
exists. It is an old method in which there are many disadvantages.
Then in your attempt to change the letter a
, everything inside your HTML is changed so that it generates something like this
< Code> & lt; P & gt; 3 & lt; Sp44n cl44ss = 'foo' & gt; J44v44 & lt; / Sp44n & gt; & Lt; / P & gt;
In the end (in a minor point) your function contains two unused parameters ( matches
and replaceFn
).
To solve your problem, the first question should be: Why do you want to use regular expression (or do it)? Thsi is a simple case, it is easy to add span
s for the straight string code, such as:
$ ('# demo'). Add (getContent (I, "J & amp; Span> Span; a & lt; span & gt; V & lt; span & gt; one & lt; / span & gt;"););
Comments
Post a Comment