Skip to content Skip to sidebar Skip to footer

X-webkit-speech: Onwebkitspeechchange Is Not Reseting The Value

I'm trying to reset my input value with onwebkitspeechchange event so that only speech text remains in value. onclick on little mic removed the text after click dialog pop up and

Solution 1:

I ran into the same problem and got it working with a simple JS function. Here's my solution:

<input x-webkit-speech="x-webkit-speech" onwebkitspeechchange="webkitSpeechChange(this);" name="myinput" value="<?php echo $this->__('Search entire store here...') ?>" class="search-query" />
<script type="text/javascript">
    //<![CDATA[
    function webkitSpeechChange(input) {
        input.value = input.value.replace('<?php echo $this->__('Search entire store here...') ?>', '');
    }
    //]]>
</script>

where <?php echo $this->__('Search entire store here...') ?> should be your default value.

Hope this helps :)


Post a Comment for "X-webkit-speech: Onwebkitspeechchange Is Not Reseting The Value"