Hey, I'm busy with a little JavaScript element, but the following rule confused me:
<a href="#" onclick="removeMap('+ \"test\" +')" style="float:right; margin-right: 30px;"><img src="images/icons/collapse.gif"></a><br/>'
The onclick remove map action is not removed. I do not know what I need to put between () so that I can put the text there. Anyone have a solution?
thank
Try simply:
onclick="removeMap('test')"
if the test is variable:
variable
onclick="removeMap(test)"
\" , onclick. . html, onclick, html double quotes , inline javascript .
\"
onclick
double quotes
inline
javascript
, JQuery JavaScript. javascript, .
JQuery
javascript HTML-, ... !
:
<a href="#" onclick="removeMap('test')" style="float:right; margin-right: 30px;"><img src="images/icons/collapse.gif"></a><br/>'
, ( , , )
Escaped quotes do not really matter in HTML. Instead, the browser will see your line as:
<a href="#" onclick="removeMap('+ \" test\ " +')" style="float:right; margin-right: 30px;" >
If onclickJavascript is broken and there are two attributes ( test\and " +')") in the tag that it does not recognize and does not know what to do with.
test\
" +')"
Source: https://habr.com/ru/post/1764300/More articles:Prediction of hibernation criteria - javaFind all instances of yellow text and change font color to red - vbaСоленый хеш передается через URL-адрес для постоянного входа без файлов cookie - phpExperience using Strobe Media Playback (OSMF)? - flashBourne Shell Building и ссылка на переменную - shellStatic class versus class instance - c #How to make vb.net application work from only one USB drive? - vb.netGenerics: when to use new () as a restriction of type parameters? - genericsjquery validate: how to save error messages from form changes - jqueryProblem loading Heroku file - ruby | fooobar.comAll Articles