1) Create a new label
method One: Var ele_input=$ (' <input/> ') ele_input.val (' You are the best ') ele_input.attr (' class ', ' Yes ') ele_input.attr (' id ') , ' no ') ele_input.appendto (' body ') method two: $ (' ele_input ',{val:' You are the most handsome ', class: ' Yes '); ID:' no '}). AppendTo (' body ')
method One: Var ele_input=$ (' <input/> ') ele_input.val (' You are the best ') ele_input.attr (' class ', ' Yes ') ele_input.attr (' id ') , ' no ') ele_input.appendto (' body ') method two: $ (' ele_input ',{val:' You are the most handsome ', class: ' Yes '); ID:' no '}). AppendTo (' body ')
2) Determine if a text is included
$ (' P '). each (function () {
if ($ (this). Text (). IndexOf (' good ') ==0) {
Console.log (There is no good this word)
}
else {
Console.log (Here are good)
$ (this). Prepend (' National Day Holiday ')
}
})
The results shown are:
1, there are countries------National Day holiday here are good
2, no country------There is no good this word
JQuery-----1) Create a new label, 2) to determine whether an element contains a text