2017-02-15 59 views
0

雖然我提到了很多與這個問題有關的答案,但我無法解決我的問題。 我的JS是如下在jquery中得到一個雙重qoutes裏的變量值

var currenteffect= $('#test').val(); 
    //alert(currenteffect); 
jQuery('#wowslider-container1').wowSlider({effect:currenteffect, prev:"", next:"", duration: 20*100, delay:20*100, width:960, height:360, autoPlay:true, autoPlayVideo:false, playPause:false, stopOnHover:false, loop:false, bullets:true, caption: true, captionEffect:"fade", controls:true, responsive:1, fullScreen:false, onBeforeStep:0, images:0 }); 

我需要得到currenteffect價值雙qoutes裏面像

大意是: 「飛」。

誰能幫我

+1

爲什麼,它不應該只要'currenteffect'是字符串'「飛」''的事? – adeneo

+0

否**字段** test **的值發生更改。 – Vimal

+0

當你這樣做時它會提醒什麼? 'alert(currenteffect);' –

回答

2
effect:currenteffect 

通過它這應該是蠻好的,你不需要雙引號,檢查其他的東西,可能有問題,在其他地方,如果你的滑塊不工作,或者你沒有達到你想要的效果。

如果你仍然想雙引號,在這裏你去

effect:'\"'+currenteffect+'\"' 
+0

我已經嘗試過,但滑塊不工作,沒有雙qoutes和工作正常與雙qoutes – Vimal

+0

這應該是一個評論 – Andreas

+0

@ VimalS試試這個效果:'\''+ currenteffect +'\「'建議在我的回答中 –

2

您可以使用JavaScript字符串()函數這樣String(currenteffect)

1

試試吧

var a = "asdfasd"; 
console.log('"'+a+'"');