custom-data-attribute

How to pass dynamic data from html data-attribute to a query using javascript?

烈酒焚心 提交于 2019-12-12 02:08:34
问题 I have this button that hold data from database <button title="View Conversation" type='button' class='btn btn-default btn-sm' data-toggle='modal' data-target='#viewConversationModal' data-empproj_id="<?=$employeeproject['emproj_id'];?>" data-empprojconvoid="<?=$employeeproject['convofeed_id'];?>" **data-empprojconvotoempid**="<?=$employeeproject['toemployee_id'];?>" **data-empprojconvofromemip**="<?=$employeeproject['fromemployee_id'];?>" data-empprojconvoconversation='"<?=$employeeproject[

HTML data attribute IE6 support

跟風遠走 提交于 2019-12-12 01:54:15
问题 Does HTML's data attribute work in IE6? I'm using the attribute like this <img id="charm_1" data-code='sdfsdfsdfsdf' data-price='100' class='addition_image' src="img/misc/donut.png" width="55" height="55" alt="Donut"> . As you can see there are 2 data attributes (price and code). I can get this with jQuery using the .data() method and it all seems to work in IE7/8/9. Does this work in IE6? I don't have a copy of IE6 to test this. 回答1: IE6 -- and indeed all other browsers on the market -- have

How can I send some initial data to the bot before the user start chatting with my bot?

拟墨画扇 提交于 2019-12-11 14:51:57
问题 My problem is, How can I send some data on behalf of user to the bot before user start chatting. because different client will have different endpoint, I would like bot to get this endpoint first and save it as UserState, then use this endpoint for making API calls later. I'm using "https://github.com/microsoft/BotFramework-WebChat" this web chat as my client side, it create the directline using the secret, is that possible i add a post activity in the html file below to send some data? Thank

Change text of all elements with specific data-attribute

北战南征 提交于 2019-12-11 11:53:57
问题 I'm currently trying to use jQuery to change the text of a number of elements to the value of a specific data-attribute. For example: index.html ---------- <h1 data-change="text2">text1</h1> <p data-change="paragraph2">paragraph1</p> I want to change 'text1' to 'text2' and 'paragraph1' to 'paragraph2' (the value of data-change for that specific element). How would I go about doing this? I assumed I would be able to 'select' all of the elements with the data-attribute 'data-change' and then

jQuery : selector targetting a dynamic attribute not working

落爺英雄遲暮 提交于 2019-12-11 11:03:08
问题 I'm trying to create a Fanorona game. http://canapin.com/web/fanorona One of my jQuery selector doesn't work as intended. After moving a blue stone by clicking it then clicking on a green space, the active player (var activePlayer) changes from "blue" to "red". $("#board").on("click", "[data-color='"+activePlayer+"']", function(){ console.log(activePlayer); console.log($(this).attr("data-color")); When the active played is "red" and I click on a red stone (data-color="red"), it does nothing.

HTML5 Tooltip via css and data- field works on link but not on image

喜你入骨 提交于 2019-12-11 07:56:19
问题 following the tutorial http://ejohn.org/blog/html-5-data-attributes/ I wanted to adapt the process of creating a tooltip for images (not links). So I adjusted the "tooltip" class rules to be generic and not a tag specific. I reproduced my efforts in the js-fiddle http://jsfiddle.net/AqPN8/ As you can see in the fiddle it does work for links but not for images. Do you have any idea why not? Technically I think that :hover and alikes should also for for <img> and not only <a> . 回答1: Images do

Evaluate a data-attibute on a div with jQuery and pass the value into a function

可紊 提交于 2019-12-11 06:28:22
问题 I have multiple slideshow blocks with preview images (for jQuery Cycle, each slideshow instance with a different delay in milliseconds) like this: <div class="content"> <div class="slideshow preview" data-delay="-2000"> <img src="media/prevslide_3.jpg" alt="Img 1" /> <img src="media/prevslide_4.jpg" alt="Img 2" /> <img src="media/prevslide_5.jpg" alt="Img 3" /> </div> </div> I want to use jQuery to pass these varying delay values (set via data-attribute)into the function that will run all

How do you nest a map method inside a map method using jquery, json and custom data attributes

Deadly 提交于 2019-12-11 05:19:51
问题 I am building a rails application. I am using a data attribute to grab the json. <% @image_urls.each_slice(5) do |row| %> <% row.each do |_, urls| %> <li class="square-image" data-urls=<%= urls.to_json %>> <span class="user-image"><%= image_tag(urls.sample) %></span> </li> <% end %> <% end %> With this json, I'm trying to update the src attribute every second by looping through the different URLs that are in the json. The timing is working. When I do the first map, I successfully grab the

Remove / (textnode) from Github Gist lists using CSS or Javascript

点点圈 提交于 2019-12-11 02:55:02
问题 I am trying to strip the username and / values from lists of gists within Github Gists, the problem being there are no classes/ids or a selector available for the / value. Here is the HTML and link to Github Gists page and JSFiddle: <div class="d-inline-block"> <span> <a data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=167012" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/hanachin">hanachin</a> / <a href="/hanachin

keep data-attributes in dijit widgets

依然范特西╮ 提交于 2019-12-11 01:57:06
问题 I've started using the HTML5 data- attributes in my application, but when this is applied to an element that is a dijit widget, it disappears. <button dojoType="dijit.form.Button" data-id="5">Number 5</button> Is dojo actually parsing this and keeping it somewhere? Or is it just removed completely because dojo isn't HTML5 compliant? 回答1: By applying the answer to this question, I was also able to keep the custom data- attributes on the surrounding element. 来源: https://stackoverflow.com