<div class='context-menu-one'>
<%= h.text_field :field %>
</div>
$(function()
{
$.contextMenu({
selector: '.context-menu-one',
items: {
"paste": {name: "Paste", icon: "paste"},
}
});
$('.context-menu-one').on('click', function(e){
console.log('clicked', this); // here ???
})
});
Thanks für your Support
Werner
either find the input by the id (look at compiled html code, but it is something like FORMNAME_FIELDNAME) and use val to get data into it.
however, if you want to reuse the function i would recommend something like this (totally not tested and straight out of my mind):
<div class="context-menu-one">
<%= h.text_field :field, data: {insert: 0} %>
</div>
and in your javascript:
$(document).ready(function() {
$('.contest-menu-one').on('click', function() {
var self = $(this);
var input = self.find('input');
var data = input.data(0); //put it to 0 and remove the data: {insert: 0}
input.val(data);
});
});
would make it a bit more reuseable...
Am Mittwoch, 17. April 2013 14:36:39 UTC+2 schrieb Werner:I need a little support with js. Would be great..I have a textfield with a hover function. If click on the popup I want a value 0 dropped into the textfield.With the code below just a alert appears...
<div class='context-menu-one'>
<%= h.text_field :field %>
</div>$(function()
{
$.contextMenu({
selector: '.context-menu-one',
items: {"paste": {name: "Paste", icon: "paste"},
}
});$('.context-menu-one').on('click', function(e){
console.log('clicked', this); // here ???
})
});
Thanks für your Support
Werner
--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/M4ia565UuJo/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/u5NASXAqtVcJ.
For more options, visit https://groups.google.com/groups/opt_out.