3
How to pass parameters from one function to another ?
Follows the code:
<body onload="getfoucs()">
<select id="select_compra" data-limit="3">
<option disabled selected style="display: none">Aaaaaaaaaaaaa</option>
<option>Bbbbbbbbb</option>
<option>Ccccccc</option>
<option>Ddddddddddd</option>
</select>
<script>
function datalimit(limit)
{
var selects = document.querySelectorAll('[data-limit]');
[].forEach.call
(
selects, function(select)
{
var limit = select.getAttribute('data-limit');
[].forEach.call
(
select.options, function(option)
{
var text = option.innerHTML.substring(0, limit);
option.innerHTML = text;
}
);
}
);
}
function getfoucs()
{
datalimit();
select_compra.addEventListener
(
'change', function()
{
datalimit(50);
/*
Como eu altero o valor de "limit" e
Chamo novamente a função datalimit()
*/
}
);
}
</script>
</body>
My intention is that by firing the event change the value of limit is changed to hold more characters and later when the select lose the focus back to the initial value that is 3(but let’s go in pieces).
You want to show more characters when I’m focused and less when I’m not focused, that’s it?
– Sergio
That’s what this is, izzas...
– MagicHat