[WordPress] 外掛分享: Gravity Forms Placeholder Add-On

首頁外掛目錄 › Gravity Forms Placeholder Add-On
1,000+
安裝啟用
★★★★
4.3/5 分(12 則評價)
3033 天前
最後更新
問題解決
WordPress 3.6+ v1.1.0 上架:2014-01-30

內容簡介

注意
該外掛基於最初由neojp開發的支援佔位符插件,可在下面的連結中找到。 主要的區別在於我們為下拉字段添加了支援。
https://wordpress.org/plugins/gravity-forms-placeholders/

此外掛提供佔位符支援給Gravity Forms WordPress外掛。

要使用此外掛,您只需將“gf-add-placeholder”類添加到您希望具有佔位符的任何字段中即可。

插件將使用標籤文本,隱藏該標籤,並將標籤文本應用於佔位符屬性。

如果您想在整個表單中使用此外掛,則只需將“gf-add-placeholder”類添加到表單本身中,然後它將應用於所有表單元素。

下拉字段

如您所知,HTML中的選擇字段沒有本機佔位符屬性。現在您可以做一些事情,只需添加說“請選擇”的選項,但我認為這不是最好的方法。

此外掛對於下拉字段提供佔位符的LIKE支援,做法如下:

它像處理其他字段一樣隱藏標籤,但然後將標籤文本作為選項的值加入到下拉字段中,並添加了selected和disabled屬性。 確保該選項已被選擇,並確保一旦用戶點擊了這個字段,他們就不能選擇並提交該選項。

將來我完全打算添加選項,使隱藏標籤能夠選擇,並且您能夠手動設置您的佔位符文本,而不僅僅是將標籤文本拉入。

此外掛需要JavaScript和JQuery來運作,並測試至WordPress版本3.8.1和Gravity Forms版本1.8。

享受!祝您編程愉快:)

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Gravity Forms Placeholder Add-On」→ 直接安裝(推薦)

原文外掛簡介

NOTE
The plugin is based off of the placeholder support add-on initially developed by neojp and can be found at the link below. The main
difference being that we added support for drop-down fields.

Gravity Forms – Placeholders add-on


This plugin gives support for placeholders to the Gravity Forms WordPress Plugin.
In order to use the plugin you need only add the class of \”gf-add-placeholder\” to any of the fields you wish to have a placeholder on.
The plugin will take the text of the label and then hide said label and apply the text from the label to the placeholder attribute.
If you would like to to use this on your entire form then you need only add the \”gf-add-placeholder\” class to the form itself and then it will be applied to all the form elements.
DROPDOWN FIELDS
As im sure you know, the select field in HTML does not have a native placeholder attribute. Now you can do what some do and just add an option that says \”please select\” but that is not (in my opinion) the best way.
This plugin does the following to give a placeholder LIKE support to the select fields
It takes and hides the label just like it does with the other fields but then it takes the text from that label and prepends an option to the select field that contains the text from the label as it\’s value and it also adds a selected and disabled attribute to the option. Ensuring that it is selected and also ensuring that once a user clicks into the field that they wont be able to select and submit with that option.
In the future i fully intend on adding features that will allow the hiding of labels to be optional and the feature for you to be able to manually set your placeholder text as opposed to it just pulling in the label text.
The plugin requires Javascript and Jquery to function and is tested up to WordPress version 3.8.1 and Gravity Forms Version 1.8
ENJOY! and happy coding 🙂

延伸相關外掛

文章
Filter
Mastodon