Jump to content

Added custom code bootstrap multiselect dropdown which automatically adds some function text.

Recommended Posts

I have implemented a bootstrap multiselect dropdown and there are some weird code added at the bottom of the list as displayed in the screenshot below. You can look at a screen grab of the same attached.
 
The drop down loads rest of the values correctly but adds up this code in the end. 
 
The html of the drop looks like this
<div class="dropdown bootstrap-select show-tick chart">
  <select multiple="" class="selectpicker chart" index="0" chart_name="Overall_Score" tabindex="-98">
    <option value="Good Value" selected="">Good text</option>
    <option value="Good Value2" selected="">Good text2</option>
    <option value="function(e,t){return this.splice(e,!t||1+t-e+(!(t<0^0<=e)&amp;&amp;(t<0||-1)*this.length)),this.length}" selected="">function(e,t){return this.splice(e,!t||1+t-e+(!(t&lt;0^0&lt;=e)&amp;&amp;(t&lt;0||-1)*this.length)),this.length}</option>
    <option value="function(e){this.removeRange(e,e)}" selected="">function(e){this.removeRange(e,e)}</option>
    <option value="function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return void this.removeAt(t)}" selected="">function(e){for(var t=0;t</option>    <option value="function(){for(var e=[];this.length;)e.push(this.splice(Math.random()*this.length,1));for(;e.length;)this.push(e.pop()[0]);return this}" selected="">function(){for(var e=[];this.length;)e.push(this.splice(Math.random()*this.length,1));for(;e.length;)this.push(e.pop()[0]);return this}</option>
    <option value="function(e){return-1<this.indexOf(e)}" selected="">function(e){return-1</option>
 </select>
</div>

 

If anyone know how to fix this issue please let me know. 
 

unnamed.png

Link to comment
  • Replies 3
  • Views 1.1k
  • Created
  • Last Reply

Agreed. More context would help. In general though, inserting JavaScript code in the "value" attribute will simply result in the code you write being shown as the option. What you're seeing is just that: the lines of JavaScript you've inserted in each "value" attribute listed as options in the select element.

If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' vote.jpg.c260784ece77aec852b0e3049c77a607.jpg (top-left)

Link to comment
13 hours ago, VikramShetty_73bit said:
I have implemented a bootstrap multiselect dropdown and there are some weird code added at the bottom of the list as displayed in the screenshot below. You can look at a screen grab of the same attached.
 
The drop down loads rest of the values correctly but adds up this code in the end. 
 
The html of the drop looks like this

<div class="dropdown bootstrap-select show-tick chart">
  <select multiple="" class="selectpicker chart" index="0" chart_name="Overall_Score" tabindex="-98">
    <option value="Good Value" selected="">Good text</option>
    <option value="Good Value2" selected="">Good text2</option>
    <option value="function(e,t){return this.splice(e,!t||1+t-e+(!(t<0^0<=e)&amp;&amp;(t<0||-1)*this.length)),this.length}" selected="">function(e,t){return this.splice(e,!t||1+t-e+(!(t&lt;0^0&lt;=e)&amp;&amp;(t&lt;0||-1)*this.length)),this.length}</option>
    <option value="function(e){this.removeRange(e,e)}" selected="">function(e){this.removeRange(e,e)}</option>
    <option value="function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return void this.removeAt(t)}" selected="">function(e){for(var t=0;t</option>    <option value="function(){for(var e=[];this.length;)e.push(this.splice(Math.random()*this.length,1));for(;e.length;)this.push(e.pop()[0]);return this}" selected="">function(){for(var e=[];this.length;)e.push(this.splice(Math.random()*this.length,1));for(;e.length;)this.push(e.pop()[0]);return this}</option>
    <option value="function(e){return-1<this.indexOf(e)}" selected="">function(e){return-1</option>
 </select>
</div>

 

If anyone know how to fix this issue please let me know. 
 

unnamed.png

I am sorry that the question wasn't clear.

We think we have found the issue. It is somehow added in our custom code. We are investigating it further. So squarespace could not be an issue

Thank you for your help. 

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.